Encoding for Devanagari Script.

Fredrik Lundh fredrik at pythonware.com
Thu Jul 24 11:59:39 EDT 2008


Atul. skrev:

> I wanted to know what encoding should I use to open the files with
> Devanagari characters. I was thinking of UTF-8 but was not sure, any
> leads on this? Anyone used it earlier?

Are we talking about existing files?  If you don't know what encoding 
the files use, you could always try using the UTF-8 codec; it's very 
likely to complain if you're attempting to decode something that's isn't 
UTF-8.

If that doesn't work, it's a bit trickier -- there are several ways to 
encode Unicode, and then there's ISCII as well.  If you cannot sort it 
out, try running this:

     >>> f = open("myfile.txt", "rb")
     >>> f.read(32)

on one of your files, and post the result, and chances are that someone 
will be able to identify the encoding.

</F>




More information about the Python-list mailing list