467,145 Members | 1,004 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,145 developers. It's quick & easy.

python unicode display of chinese characters

Hi,

I've done some google searching w/c referred me to a couple of
articles on unicode, but I'm looking for something really simple - not
for a web application.

See my sample code below. Any ideas how to convert it to display
maybe Simplified Chinese ?

Rgds,
Dennis

================================================== ==
#ucode.py

#get unicode number
ucode_num = str(raw_input('Enter the string : '))

#define constants
encode_type = 'utf-8'
display_type = 'cp-347' #for IBM consoles

#define unicode
character_display = unicode(ucode_num, encode_type)
#print character to be displayed
print character_display.encode(display_type)

Jul 18 '05 #1
  • viewed: 6095
Share:
1 Reply
> "Posadas, Dennis" <de************@intel.com> wrote in message news:<ma***********************************@python .org>...
Hi,

I've done some google searching w/c referred me to a couple of
articles on unicode, but I'm looking for something really simple - not
for a web application.

See my sample code below. Any ideas how to convert it to display
maybe Simplified Chinese ?


The first idea is to debug input and output separately, i.e. save
your Chinese text to utf-8 file in a Chinese-aware editor. Read
it from your Python program and try to display.
You're trying to use cp347 encoding, did you install it? My
python installation does not have it.
What console do you use? Are you sure it supports cp347?

-- Serge.

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by carroll@tjc.com | last post: by
12 posts views Thread by Onega | last post: by
7 posts views Thread by kernel1983 | last post: by
9 posts views Thread by =?Utf-8?B?dHBhcmtzNjk=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.