question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

This is all a learning experience for me so the answer may be obvious and I am just missing it.

If I create a list as such:

LangQuestion = [
    inquirer.List('lang',
                  message="Select Language",
                  choices=['English', 'Français', 'Deutsche'],
              ),# ç
]

answers = inquirer.prompt(LangQuestion)

pprint(answers)

It breaks due to UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 4: ordinal not in range(128)

However anywhere else in my project where I reference Français and does not involve using inquirer it works fine. Is there a way to expand the ascii to accommodate such characters? I thought UTF-8 would cover all of it to begin with but again this is outside of my realm of knowledge.

Thank you for your time!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
magmaxcommented, Aug 10, 2018

You are right, but this problem only happens in python 2, and it has a year and a half life time. In addition, Inquirer is about user’s input. So I think this is Inquirer responsibility. Anyway, this makes it easy for any developer to use Inquirer, even more if they use the JSON configuration format.

I think this solution is “good enough”. Maybe it is not the best one, but will work in most common cases.

0reactions
AuHaucommented, Aug 10, 2018

Hmm looking at your solution, I would quiet object that it is a good one. I don’t think library should do such operations, it should be the user’s responsibility to provide valid input, which in this case means properly decoded strings in case of Python 2. What if for example, somebody would use a different encoding, I know that in these days it is not really common to use something else then UTF-8, but it is a possibility…

But it is your call 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a problem with using ASCII? - Quora
The problem with ASCII is that it only supports letters from basic English (Latin-1) alphabet. So whenever you want to use a non-English...
Read more >
ASCII | Definition, History, Trivia, & Facts | Britannica
ASCII, in full American Standard Code for Information Interchange, a standard data-encoding format for electronic communication between computers.
Read more >
Be careful with ASCII issue when working with text - Medium
Be careful with ASCII issue when working with text. Today I encountered a weird bug, which I later found out relating to ASCII...
Read more >
ASCII char issue in UTF-8 - Oracle Communities
Hi, I am using XML with UTF-8 character encoding, there is a customer name which is in chinese char coming from DB is...
Read more >
Ascii character Issue in Oracle Database - sql - Stack Overflow
I have a problem about running sql script in Oracle Sql Developer. There is an issue regarding invalid character. How can I fix...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found