Comment 12 for bug 9931

Revision history for this message
Olivier Cortès (olive) wrote :

I understand the last statement, but i'd like an advice :

When i get input in python from my utf-8 terminal, if a global-like setting (like site.py) is telling me that input is utf-8, from what/where source could I know input is coming as utf-8 ?

I think I should inspect the locale, the deduce the charset, and then "something" globally for my app to know that every unicode() call should translate from utf-8. Is that right ?

If tha'ts the case, knowing that all my ubuntu system is utf-8 aware and configured for, i thought it was "easyer" but consistant too, for site.py to detect this and set it globally for python.

my 2 cents : in site.py, i didn't change the default encoding (let it to us-ascii), but I activated the "if 0:" lines, which find the locale and set the defaut encoding from the locale charset. In this case, when the locale is unset or its charset unknow, defaut goes back to us-ascii, and I feel this very consistant.

What's you opinion ? Should I point at elsewhere to find an already discussed topic ?