-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ephemetoot may die when encountering utf8 encoded toots #11
Comments
Hmm, weird, Python3 should read and write strings using utf-8 by default. Can you tell me more about your environment, @billalbertson? What OS and Python version are you running? |
Running OpenBSD 6.5, with the python-3.6.8p0 package installed. I can verify that directly when I get home.
…On July 22, 2019 12:20:41 AM PDT, Hugh Rundle ***@***.***> wrote:
Hmm, weird, Python3 should read and write strings using utf-8 by
default. Can you tell me more about your environment, @billalbertson?
What OS and Python version are you running?
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#11 (comment)
___
Bill Albertson
[email protected]
|
Hey @billalbertson I had another look at this and it looks like this should be more or less resolved as of Python 3.7 Essentially the problem is that Python likes to cooperate with other tools and libraries, and prior to v3.7 will always use the locale settings in the host OS. LIke several other *nix systems, OpenBSD uses US ASCII as the default locale character encoding. As of Python 3.7 there is now a setting called PYTHONCOERCECLOCALE which defaults to being on and coercing the locale value to UTF-8. If you're interested in the background there's a big explanation in Python PEP 538 which led to the change. So I guess there are three possible solutions for anyone encountering this:
I probably should add something in the docs to this effect. |
Thank you for the additional information and follow up! Love ephemetoot...
…On July 22, 2019 3:07:30 PM PDT, Hugh Rundle ***@***.***> wrote:
Hey @billalbertson I had another look at this and it looks like this
should be more or less resolved as of Python 3.7
Essentially the problem is that Python likes to cooperate with other
tools and libraries, and prior to v3.7 will always use the locale
settings in the host OS. LIke several other *nix systems, OpenBSD [uses
US ASCII as the default](https://man.openbsd.org/locale.1) locale
character encoding. As of Python 3.7 there is now a setting called
[PYTHONCOERCECLOCALE](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONCOERCECLOCALE)
which defaults to being on and coercing the locale value to UTF-8. If
you're interested in the background there's a big explanation in
[Python PEP 538](https://www.python.org/dev/peps/pep-0538/) which led
to the change.
So I guess there are three possible solutions for anyone encountering
this:
1. Use the `PYTHONIOENCODING=utf-8` env setting when running the
script, as you have described
2. Set the OS locale to UTF-8 in your ~/.profile file (e.g. `export
LC_CTYPE=en_US.UTF-8`) - though this might have unintended consequences
3. Upgrade to Python 3.7
I probably should add something in the docs to this effect.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#11 (comment)
___
Bill Albertson
[email protected]
|
Thanks for bringing it to my attention! |
Adding "PYTHONIOENCODING=utf-8" fixes the error. Error and post error with utf-8 setting below.
The text was updated successfully, but these errors were encountered: