[I18n-sig] Support for Devanagari Script

Andy Robinson andy at reportlab.com
Fri Sep 8 08:49:25 CEST 2006


> 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).

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




More information about the I18n-sig mailing list