python unicode display of chinese characters

  • Thread starter Posadas, Dennis
  • Start date
P

Posadas, Dennis

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

Serge Orlov

Posadas said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top