473,799 Members | 3,077 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_displ ay = unicode(ucode_n um, encode_type)
#print character to be displayed
print character_displ ay.encode(displ ay_type)

Jul 18 '05 #1
1 7035
> "Posadas, Dennis" <de************ @intel.com> wrote in message news:<ma******* *************** *************@p ython.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2624
by: carroll | last post by:
Does wxPython handle Unicode strings (specifically, Unihan strings, with Chinese characters) easily? I'm writing an app to help me explore the Chinese character sets, and can do basic displays of the characters in Tkinter, but Tkinter looks daunting as I try to grow the app beyond a simple display. wxPython looks easier to use; but will it handle Chinese characters?
1
7566
by: Daman | last post by:
Hi, I am currently facing difficulty displaying chinese, japanese, russian etc. characters. I am using VB 6 and ADO to query the DB2 Version 7.2 unicode database (UTF-8). The resultset that comes back contains garbage characters for Chinese, Russian etc languages. The english characters come back fine using ADO. It seems that DB2 assumes that my application is NOT Unicode compliant.
12
3896
by: Onega | last post by:
Hi I create a simple win32 project (VC2003, windows2003(English) , and do simple paint in WM_PAINT message, when the project use multi-character set, it is OK. but when I change to UNICODE, some Chinese characters are illegible( I see sizeof(TCHAR)=2 being displayed). Your idea is welcome. case WM_PAINT: hdc = BeginPaint(hWnd, &ps);
40
3251
by: apprentice | last post by:
Hello, I'm writing an class library that I imagine people from different countries might be interested in using, so I'm considering what needs to be provided to support foreign languages, including asian languages (chinese, japanese, korean, etc). First of all, strings will be passed to my class methods, some of which based on the language (and on the encoding) might contain characters that require more that a single byte.
3
5439
by: Jennifer | last post by:
Hi, Is there anyone to have idea how to make the MFC CDialog box display Unicode (like Chinese characters) in .NET 2005? We have some dilog boxes created from CDialog class in VC++ 6.0 and try to integrate them into our new project developed in .NET 2005 to display Unicode. Any idea and hint will be greatly appreciated. Thank you in advance. Jennifer
7
2147
by: kernel1983 | last post by:
I'm try to build a bundle on OS X, so I write a simple python script for a test: #!/usr/bin/env python import EasyDialogs EasyDialogs.Message("Hello,Mac!") This runs OK,but when I try to replace "Hello,Mac!" with chinese, it can't be display rightly.
9
14146
by: =?Utf-8?B?dHBhcmtzNjk=?= | last post by:
OK I have some Chinese text in sql server column that looks like this: 12大专题调研破解广东科学发展难题 This is unicode? Anyway, I put this data into a text area like this: articleArea.InnerHtml = article.Text . . .. and it works fine (shows chinese characters). But when I put this data into a asp:textbox control, it just shows up as is... (12大&# etc...) Can anyone tell me how to get the characters to appear...
13
3932
by: Liang Chen | last post by:
Hope you all had a nice weekend. I have a question that I hope someone can help me out. I want to run a Python program that uses Tkinter for the user interface (GUI). The program allows me to type Chinese characters, but neverthelss is unable to show them up on screen. The follow is some of the error message I received after I logged off the program: "Could not write output: <type "exceptions: UnicodeEncodeError'>, 'ascii' codec can't...
0
1076
by: Terry Reedy | last post by:
Liang Chen wrote: Start with the Unicode HOWTO in the HOWTOs part of the Manual set. For 2.6 http://docs.python.org/howto/unicode.html For 3.0, which has been updated in spite of the warning http://docs.python.org/dev/3.0/howto/unicode.html
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9538
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10025
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7563
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5461
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5584
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.