[I18n-sig] Support for Devanagari Script

Vijaya Poudyal vjktm at yahoo.com
Sat Sep 9 00:46:19 CEST 2006


Hi Andy,
  I tried my example at the command prompt in XP and Xbash (cygwin).  Python cannot decode the unicode in both cases.  In IDLE I get the wrong rendering.  I was not able to the "renders ... exactly the same ..." behavior you mentioned.
   
  When you say kSa.encode('utf8') do you get "Hello" followed by two characters joined along the top or just one character (as in the html)?  When I run it I get two characters and this is a wrong rendering of the code point sequence.
   
  vjktm

Andy Robinson <andy at reportlab.com> wrote:
  > The main determining factor is whether the stdout can render the l
> 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).

Regrettably not all fonts have the character set you want and the DOS 
prompt is not a smart enough display device. However, browsers and IDLE 
are smart enough to switch to a 'fallback font' for characters they 
cannot display.

In Idle, which uses Courier (300kb on Windows), I get;

>>> print kSa.encode('UTF-8')

works fine.

>>> print kSa.encode('UTF-16')

prints rubbish.

>>> print kSa
works too but is almost certainly converting to utf8.

>From a DOS prompt, the UTF8 version prints rubbish. The command prompt 
font properties only give me two font choices, 'Raster Fonts' and 
'Lucida Console'. When I switch IDLE to a variety of different fonts, I 
still get the Devanagari character, IN THE SAME TYPEFACE, whichever font 
I choose.

Conclusion: DOS prompt does not have the display routines needed to 
handle Unicode output.

- Andy Robinson




 		
---------------------------------
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/add03d64/attachment.html 


More information about the I18n-sig mailing list