September 9th, 2003, 09:57 AM
unicode, latin-1 and all that bore...
Being a relatively newbie to python I ran into this problem:
I have an app with embedded python 2.2
Problem is that it has to run in german so it obviously needs to support ther german chars öäüÖÄÜß.
To test this i wrote this small script:
to see the default encoding etc. (cause i just couldnt get it to work)
print "defaultlocale: " + str(locale.getdefaultlocale())
umlautStr = "\xfc \xc4"
print "\\xfc encoded: " + umlautStr
a = "German special CHARs: äüö ÄÜÖ ß"
a = unicode(a,'latin-1')
print "latin-1: " + str(a.encode('latin-1','replace'))
print "encoding Latin not working"
print "ascii: " + (a.encode('ascii','replace'))
print "encoding Ascii not working"
print "cp1252: " + str(a.encode('cp1252','replace'))
print "encoding cp1252 not working"
using the script in IDLE or the commandline it correctly gives:
with my implementation i get:
I dont have the "encodings" folder in the app (i added it later by copying it in, but to little effect)
So my actual questions would be:
where do i start looking for the missing encodings? what .py .h .lib .whatever file am i missing here?
why doesnt it just work?
and who stole that marsbar from my desk drawer?