Detecting filename-encoding (on WinXP)?
Christos Georgiou
tzot at sil-tec.gr
Fri Feb 10 04:18:33 EST 2006
On 2 Feb 2006 08:03:14 -0800, rumours say that "Tim N. van der Leeuw"
<tim.leeuwvander at nl.unisys.com> might have written:
>So now what I need to know is, how do I find out in what encoding a
>particular filename is? Is there a portable way for doing this?
You said the filename comes as data, and not as contents of os.listdir(),
right?
You can only know (for almost certain) what encoding is *not* the filename
(by looping over encodings and marking those where .decode fails).
If it was textual data, you could be more successful in guessing (btw, it's
been a long time since I requested example texts from various encodings for
my encoding-guessing app, but I was sent only one) by testing characters in
pairs and their frequencies.
--
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians
More information about the Python-list
mailing list