a unicode question?

Serge Orlov Serge.Orlov at gmail.com
Mon Apr 10 03:34:57 EDT 2006


zdwang at xinces.com wrote:
> Mr. John Machin
>
> This question come form the flow codes. I use the PyXml to build a DOM
> tree.
>
> from xml.dom.ext.reader import HtmlLib
> doc =
> HtmlLib.FromHtmlUrl('http://stock.business.sohu.com/q/nbcg.php?code=600028')
> title_elem = doc.documentElement.getElementsByTagName("TITLE")[0]
> title_string = title_elem.firstChild.data
> print title_string
>
> # the title_string is unicode, but it is not "latin1" code, so I wantto
> change it.

Errr, but the title of the page is written in Chinese and it is not
supposed to be crammed into latin1 encoding. What are you trying to do
with the string after you squeezed Chinese into latin1?




More information about the Python-list mailing list