[I18n-sig] Support for Devanagari Script

Vijaya Poudyal vjktm at yahoo.com
Fri Sep 8 13:26:59 CEST 2006

Hi John,
  Thank you for the suggestions.
  I am working on Windows.  I did try encoding to UTF-8 but that did not help.
  I am new to Python, and thought that there may be a way to change the fonts used to display those characters.  The reason I wanted to try a different font is that if the fonts do not contain the glyphs corresponding to the correct ligature then the characters will not render as expected.  BTW, I also tried writing a Label to a Tkinter window and that did not work either, I got the same sequence of two glyphs instead of a single glyph.
  The IDLE rendering is allowed only if the correct glyph is not available in the font.
  I think it may also occur if consonant clusters are not handled correctly (I don't know what part of the code does this after I use the print statement) as per the Unicode standards for Devanagari.)
  The IE rendering is required if the correct glyph does exist.
  Thanks for the suggestions.

John Machin <sjmachin at lexicon.net> wrote:
  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')


Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/i18n-sig/attachments/20060908/03f622fb/attachment.html 

More information about the I18n-sig mailing list