Distinguishing cp850 and cp1252?

David Eppstein eppstein at ics.uci.edu
Mon Nov 3 02:36:13 CET 2003


I'm working on some Python code for reading files in a certain format, 
and the examples of such files I've found on the internet appear to be 
in either cp850 or cp1252 encoding (except for one exception for which I 
can't find a correct encoding among the standard Python ones).

The file format itself includes nothing about which encoding is used, 
but only one of the two produces sensible results in the non-ascii 
examples I've seen.

Is there an easy way of guessing with reasonable accuracy which of these 
two incodings was used for a particular file?

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-list mailing list