Message 23598 - Python tracker
Logged In: YES user_id=21627 getdefaultencoding might be "targeted" at the OS level - but the implementation certainly is not. On the OS level, the C library will often use a different encoding after locale.setlocale(locale.LC_ALL,"") is called, compared to what getdefaultencoding returns. The approach takien inside getdefaultencoding is inherently flawed, and cannot possibly work in all cases; getpreferredencoding fixes that flaw.