Re: Support for Devanagari Script
Vijaya Poudyal <[email protected]> Fri, 8 Sep 2006 04:26:59 -0700 (PDT)
| Newsgroups | gmane.comp.python.internationalization |
|---|---|
| Message-ID | <[email protected]> |
--===============1370457724== Content-Type: multipart/alternative; boundary="0-1552510684-1157714819=:50441" --0-1552510684-1157714819=:50441 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by smtp-vbr8.xs4all.nl id k88BR39N091839 Hi John, Thank you for the suggestions. I am working on Windows. I did try encoding to UTF-8 but that did not = help. =20 I am new to Python, and thought that there may be a way to change the f= onts used to display those characters. The reason I wanted to try a diff= erent font is that if the fonts do not contain the glyphs corresponding t= o 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 wo= rk either, I got the same sequence of two glyphs instead of a single glyp= h. =20 The IDLE rendering is allowed only if the correct glyph is not availabl= e in the font. I think it may also occur if consonant clusters are not handled correct= ly (I don't know what part of the code does this after I use the print st= atement) as per the Unicode standards for Devanagari.) The IE rendering is required if the correct glyph does exist. =20 Thanks for the suggestions. vjktm John Machin <[email protected]> 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=20 > implement a Sanskrit transliteration translation program. I did=20 > accomplish it but the Unicode Devanagari script is not displaying as I=20 > expect on the python interpreter output lines. The same sequence of=20 > unicode does render as expected if I write it to an html file and open=20 > it with a web browser.=20 >=20 > The attached code does both, I cannot figure out if I am doing somethin= g=20 > wrong, or not setting up the fonts correctly in python, or python does=20 > not fully implement the unicode standard (for this script).=20 >=20 > I hope this is the right group to ask the question. Thanks for any help. >=20 > vjktm >=20 It's not that much to do with Python. The concept of "setting up the=20 fonts ... in Python" is rather novel -- what do you mean? The main determining factor is whether the stdout can render the=20 bytestream that's thrown at it, and that depends on where you are=20 running your script. For example, on Windows, IDLE renders your UTF16=20 exactly the same as Firefox, Opera and IE6 render the UTF8 in the=20 created ex2.html. However running the script at the (DOS) command prompt=20 will throw an exception (unless there's a Devanagari DOS codepage). [Aside: the result from IDLE and the browsers appears (to someone=20 knowing very little about how characters combine in Indic scripts) as=20 one character which looks nothing like the 1st & 3rd input characters --=20 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=20 throwing utf8 at the stdout, rather than utf16 -- have you tried print kSa.encode('utf_8') ? HTH Cheers John =09 --------------------------------- Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ co= untries) for 2=A2/min or less. --0-1552510684-1157714819=:50441 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by smtp-vbr8.xs4all.nl id k88BR39N091839 <div>Hi John,</div> <div>Thank you for the suggestions.</div> <div>I am= working on Windows. I did try encoding to UTF-8 but that did not h= elp.</div> <div> </div> <div>I am new to Python, and thought that = there may be a way to change the fonts used to display those characters.&= nbsp; 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 ch= aracters will not render as expected. BTW, I also tried writing&nbs= p;a Label to a Tkinter window and that did not work either, I got the sam= e sequence of two glyphs instead of a single glyph.</div> <div> </d= iv> <div>The IDLE rendering is allowed only if the correct glyph is not = available in the font.</div> <div>I think it may also occur if consonant= clusters are not handled correctly (I don't know what part of the c= ode does this after I use the print statement) as per the Unicode standar= ds for Devanagari.)</div> <div>The IE rendering is required if the correct glyph does exist.</div> <div> = ;</div> <div>Thanks for the suggestions.</div> <div>vjktm<BR><BR><B><I>= John Machin <[email protected]></I></B> wrote:</div> <BLOCKQUOT= E class=3Dreplbq style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEF= T: #1010ff 2px solid">On 8/09/2006 11:06 AM, Vijaya Poudyal wrote:<BR>>= ; Hi,<BR>> I have recently discovered the power of Python. I started b= y trying to <BR>> implement a Sanskrit transliteration translation pro= gram. I did <BR>> accomplish it but the Unicode Devanagari script is n= ot displaying as I <BR>> expect on the python interpreter output lines= . The same sequence of <BR>> unicode does render as expected if I writ= e it to an html file and open <BR>> it with a web browser. <BR>> <B= R>> The attached code does both, I cannot figure out if I am doing som= ething <BR>> wrong, or not setting up the fonts correctly in python, o= r python does <BR>> not fully implement the unicode standard (for this script). <BR>> <BR>> I hope this is= the right group to ask the question. Thanks for any help.<BR>> <BR>&g= t; vjktm<BR>> <BR><BR>It's not that much to do with Python. The concep= t of "setting up the <BR>fonts ... in Python" is rather novel -- what do = you mean?<BR><BR>The main determining factor is whether the stdout can re= nder the <BR>bytestream that's thrown at it, and that depends on where yo= u are <BR>running your script. For example, on Windows, IDLE renders your= UTF16 <BR>exactly the same as Firefox, Opera and IE6 render the UTF8 in = the <BR>created ex2.html. However running the script at the (DOS) command= prompt <BR>will throw an exception (unless there's a Devanagari DOS code= page).<BR><BR>[Aside: the result from IDLE and the browsers appears (to s= omeone <BR>knowing very little about how characters combine in Indic scri= pts) as <BR>one character which looks nothing like the 1st & 3rd inpu= t characters -- <BR>presumably that is expected(?)]<BR><BR>You will need to give more details about your enviro= nment.<BR><BR>I know little abouut Unix or Linux, but I'd expect better r= esults from <BR>throwing utf8 at the stdout, rather than utf16 -- have yo= u tried<BR>print kSa.encode('utf_8')<BR>?<BR><BR>HTH<BR>Cheers<BR>John<BR= ></BLOCKQUOTE><BR><p>  <hr size=3D1>Yahoo! Messenger with Voice. <a href=3D"http://us.rd.yahoo= .com/mail_us/taglines/postman1/*http://us.rd.yahoo.com/evt=3D39663/*http:= //voice.yahoo.com">Make PC-to-Phone Calls</a> to the US (and 30+ countrie= s) for 2=A2/min or less. --0-1552510684-1157714819=:50441-- --===============1370457724== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 7bit _______________________________________________ I18n-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/i18n-sig --===============1370457724==--