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

From: Erik Bethke (erikbethke_at_gmail.com)
Date: 02/09/05


Date: 9 Feb 2005 04:56:04 -0800

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



Relevant Pages

  • Re: Tk 8.4.11 / Windows XP / Encoding problem
    ... Some of our clients are experiencing a weird problem on their Windows XP PCs. ... suddenly they start showing other characters instead of the correct utf-8 ... I also checked to see if the encoding in our ...
    (comp.lang.tcl)
  • Re: Tk 8.4.11 / Windows XP / Encoding problem
    ... Some of our clients are experiencing a weird problem on their Windows XP PCs. ... I also checked to see if the encoding in our ... but it reported "utf-8" as it should. ... Tcl usually does proper detection of the system encoding. ...
    (comp.lang.tcl)
  • Re: Add Windows User to ADAM Role using LDIFDE.exe
    ... Note you can use admod to do this right at the command line without the encoding. ... Joe Richards Microsoft MVP Windows Server Directory Services ... created in your ADAM instance and that will cause a violation when you try ...
    (microsoft.public.windows.server.active_directory)
  • Re: length of char in bits differs on Win/Linux and Mac
    ... You were just lucky on Windows with your algorithm, and you used the wrong encoding for reading on the Mac. ... because Java uses Unicode for all characters. ...
    (comp.lang.java.programmer)
  • Re: IE 6 sp2 - encoding problem
    ... Encoding setting Unicode that I normally use to the Western ... I have Windows XP Pro. ... European and I manually put it on Western European ... Resolving problems with the IE toolbars being out of sync ...
    (microsoft.public.windows.inetexplorer.ie6.browser)

Loading