[Python-Dev] Fix IO Encoding issue for embedded Python under Windows - Issue16129

Nick Coghlan ncoghlan at gmail.com
Fri Oct 11 00:10:06 CEST 2013


On 11 Oct 2013 01:22, "Bastien Montagne" <montagne29 at wanadoo.fr> wrote:
>
> Hi Py Devs,
>
> As this is my first mail here, first a short presentation: my name is
Bastien Montagne (aka mont29), I live in France, and I’ve been using Python
for a fair amount of years now in various projects, amongst which Blender
3D software. I’m also a Blender dev (C & Py) since a few years.
>
> Now to the topic, to summarize http://bugs.python.org/issue16129 , an
application dynamically linking against Python under MS-Windows has no way
to control Python's environment, and hence cannot set PYTHONIOENCODING to
get another encoding than default Windows' console (which is usually 8bit,
like cp437). This is really annoying under Blender, as we use utf-8
strings, users having e.g. "special" chars in their file paths keep getting
python errors instead of nice prints…
>
> Following Nick Coghlan’s suggestions, I made a patch which solves that
issue by adding Py_SetStandardStreamEncoding() to the API, which allows
embedding code to directly specify standard IO encodings. So now I’m
waiting for reviews & comments from py devs, in the hope that this can make
it into python code before 3.4 feature freeze (patch:
http://bugs.python.org/file31985/setstdio.diff ).

Sorry for the radio silence - this is on my list to look at before alpha 4.
(The main thing ahead of it on the to do list was the PEP 453 update to
limit the functional changes to 3.4 only, which is now with Donald for
review before we submit it for pronouncement).

However, if someone else wanted to tackle Bastien's patch before I get to
it, I certainly wouldn't complain :)

Cheers,
Nick.

>
> Best regards,
> Bastien
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20131011/7289f41e/attachment.html>


More information about the Python-Dev mailing list