Hi,

Every 7 bits encodings will always be valid UTF8 as the range U+0000..U+007F is 
explicitly (documented as) valid in UTF8.


So, there will always be the possibility to find legitimate UTF-8 encoded 
documents matching sequences found in ISO-2022-JP, like:
'\x1B\x28\x42' which is "control, left parenthesis, LATIN CAPITAL LETTER B".

If you want to start speaking about probabilities that a given document is UTF8 
or ISO-2022-JP according to a frequency analysis of common patterns, you're not 
talking about `isutf8` but `chardet`.

The role of isutf8 is *only* to tell if a given bit sequence is valid in utf8,
it means that false positives are acceptable (ASCII is UTF-8 compatible, so if 
a document is encoded in ASCII, isutf8 will falsely tell it's valid, which is 
acceptable) but
false negatives are not acceptable: every encoding error have to be reported.

Bests,
--
Julien Palard
https://mdk.fr

Reply via email to