How to display Chinese in a list retrieved from database via python
Chris Rebert
clp at rebertia.com
Thu Dec 25 02:35:13 EST 2008
On Wed, Dec 24, 2008 at 11:29 PM, zxo102 <zxo102 at gmail.com> wrote:
> Hi,
> I retrieve some info in Chinese from postgresql and assign it to a
> variable 'info' defined in javascript of a html page:
> var info = ['\xd6\xd0\xce\xc4','\xd6\xd0\xce\xc4','\xd6\xd0\xce
> \xc4']
> But I want it to be
> var info = ['中文','中文','中文']
> since in html pages (via javascript), the items in chinese out of the
> former :['\xd6\xd0\xce\xc4','\xd6\xd0\xce\xc4','\xd6\xd0\xce\xc4'] can
> not be displayed correctly when it is inserted into a html page. If
> the list is var info = ['中文','中文','中文'] , then everything works
> fine.
>
> Anybody knows how to solve this problem?
Upgrading to Python 2.6 would probably be beneficial due to its better
handling of Unicode.
Also, posting some of the actual code you're using (to generate
JavaScript, I guess?) would definitely help.
Merry Christmas,
Chris
--
Follow the path of the Iguana...
http://rebertia.com
More information about the Python-list
mailing list