Ubunu - Linux - Unicode - encoding

Franz Steinhaeusler franz.steinhaeusler at gmx.at
Thu Feb 1 10:02:52 EST 2007


Hello NG, a little longer question,

I'm working on our project DrPython and try fix bugs in Linux,
(on windows, it works very good now with latin-1 encoding).

On Windows, it works good now, using setappdefaultencoding and the right
encoding for open with styled text control with the right encoding the
files. (I see the german Umlauts äöü and the "strong 's'" "ß")

The case:
I have a file on a WindowsXP partition which has as contents german
umlauts and the filename itself has umlauts like iÜüäßk.txt

If I want to append this file to a list, I get somehow latin-1, cannot
decode 'utf-8'.

sys.setappdefaultencoding(self.prefs.defaultencoding) would be the
easiest solution which should be the same aus sys.setdefaultencoding in
linux.

Why is there a setappdefaultencoding on Windows and
sys.setdefaultencoding on linux.

I googled, and I found a strange solution (sys.setdefaultencoding is not
available)

import sys
reload (sys)

only then this function is available.
Why is this setdefaultencoding otherwise not working on linux?

(Also Filemanagers like Nautilus or Krusader cannot display the files
correctly).

Is there a system wide linux language setting (encoding), which I have
to install and adjust?

I know, there are the methods encode, unicode, decode, but how do I
know, when they are needed, I don't want to replace all the source for
encode, ... for string access.
So setappdefaultencoding would be the easiest way.

Should I use also/instead the wx.SetDefaultPyEncoding in DrPython?

This would be the easiest solution, setappdefaultencoding, (getting it
from preferences) but it doesn't work.

Beside I tried other editors like spe, pype, boa, ulipad, but none of
them displayed the file, which have german umlauts in the filesnames,
correctly.

Thank you verrrry much in advance for a possible solution.




More information about the Python-list mailing list