[I18n-sig] XML and UTF-16

Paul Prescod paulp@ActiveState.com
Thu, 31 May 2001 14:21:24 -0700


"M.-A. Lemburg" wrote:
> 
>...
> 
> Perhaps we should have some smart auto-detection API somewhere
> which does this automagically ?! Something like
> 
>         guess_xml_encoding(data) -> encoding string
> 
> It could work by looking at the first 256 bytes of the data
> string and then apply all the tricks needed to extract the
> encoding information (or default to UTF-8 if no such information
> is given).

This might help:

http://aspn.activestate.com/ASPN/Python/Cookbook/Recipe/52257

I think Lars has a version too...

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook