A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-October/092751.html below:

[Python-Dev] Logging, Unicode and sockets

[Python-Dev] Logging, Unicode and socketsVinay Sajip vinay_sajip at yahoo.co.uk
Thu Oct 8 08:11:23 CEST 2009
>
Thanks to 

http://bugs.python.org/issue7077

I've noticed that the socket-based logging handlers - SocketHandler,
DatagramHandler and SysLogHandler - aren't Unicode-aware and can break in the
presence of Unicode messages. I'd like to fix this by giving these handlers an
optional (encoding=None) parameter in their __init__, and then using this to
encode on output. If no encoding is specified, is it best to use
locale.getpreferredencoding(), sys.getdefaultencoding(),
sys.getfilesystemencoding(), 'utf-8' or something else? On my system:

>>> sys.getdefaultencoding()
'ascii'
>>> sys.getfilesystemencoding()
'mbcs'
>>> locale.getpreferredencoding()
'cp1252'

which suggests to me that the locale.getpreferredencoding() should be the
default. However, as I'm not a Unicode maven, any suggestions would be welcome.

Regards,


Vinay Sajip 

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4