Trouble with the encoding of os.getcwd() in Korean Windows

Erik Bethke erikbethke at gmail.com
Wed Feb 9 07:56:04 EST 2005


Hello All,

I have found much help in the google archives but I am still stuck...

here is my code snippet:
	path = os.getcwd()
        path = path.decode('UTF8')

Now the trouble is I am getting that darn UnicodeDecodeError, where it
is tripping up on the Korean hangul for My Desktop.  Now I have tried
utf8 and utf16 and neither of these works.

So is this my question?:  What encoding does windows use for Korean
Windows?  I thought it might be and so I surfed around
(http://foundationstone.com.au/HtmlSupport/OnlineHelp/Localisation/SupportedEncodings.html)
and there appears to be an encoding called: windows-949 labeled to be
Korean Windows, which of couse is *not* one of the encodings to be
found in the encodings package... which would suck.

But then I thought about it some more, how could you make software to
do things like read the current directory work on different language
machines???  It would be madness to have a try statement for each and
every encoding under the sun...

Why isn't there a get system encoding method?

Or am I on the entirely wrong track?

Thanks,
-Erik




More information about the Python-list mailing list