[I18n-sig] Support for Devanagari Script

John Machin sjmachin at lexicon.net
Fri Sep 8 05:14:11 CEST 2006


On 8/09/2006 11:06 AM, Vijaya Poudyal wrote:
> Hi,
> I have recently discovered the power of Python.  I started by trying to 
> implement a Sanskrit transliteration translation program.  I did 
> accomplish it but the Unicode Devanagari script is not displaying as I 
> expect on the python interpreter output lines.  The same sequence of 
> unicode does render as expected if I write it to an html file and open 
> it with a web browser. 
>  
> The attached code does both, I cannot figure out if I am doing something 
> wrong, or not setting up the fonts correctly in python, or python does 
> not fully implement the unicode standard (for this script). 
>  
> I hope this is the right group to ask the question.  Thanks for any help.
>  
> vjktm
>  

It's not that much to do with Python. The concept of "setting up the 
fonts ... in Python" is rather novel -- what do you mean?

The main determining factor is whether the stdout can render the 
bytestream that's thrown at it, and that depends on where you are 
running your script. For example, on Windows, IDLE renders your UTF16 
exactly the same as Firefox, Opera and IE6 render the UTF8 in the 
created ex2.html. However running the script at the (DOS) command prompt 
  will throw an exception (unless there's a Devanagari DOS codepage).

[Aside: the result from IDLE and the browsers appears (to someone 
knowing very little about how characters combine in Indic scripts) as 
one character which looks nothing like the 1st & 3rd input characters -- 
presumably that is expected(?)]

You will need to give more details about your environment.

I know little abouut Unix or Linux, but I'd expect better results from 
throwing utf8 at the stdout, rather than utf16 -- have you tried
    print kSa.encode('utf_8')
?

HTH
Cheers
John


More information about the I18n-sig mailing list