473,683 Members | 2,835 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get the ascii code of Chinese characters?

Hi,everyone:

Have you any ideas?

Say whatever you know about this.
thanks.

Aug 19 '06 #1
19 32808
many_years_afte r wrote:
Hi,everyone:

Have you any ideas?

Say whatever you know about this.
thanks.
Hi,

You mean unicode I assume:
http://www.rikai.com/library/kanjita....unicode.shtml

Regards,

Philippe

Aug 19 '06 #2
many_years_afte r wrote:
Hi,everyone:

Have you any ideas?

Say whatever you know about this.
Perhaps you had better explain what you mean by "ascii code of Chinese
characters". Chinese characters ("hanzi") can be represented in many
ways on a computer, in Unicode as well as many different "legacy"
encodings, such as GB, GBK, big5, two different 4-digit telegraph
codes, etc etc. They can also be spelled out in "roman" letters with or
without tone indications (digits or "accents") in the pinyin system --
is that what you mean by "ascii code"?

Perhaps you might like to tell us what you want to do in Python with
hanzi and "ascii codes", so that we can give you a specific answer.
With examples, please -- like what are the "ascii codes" for the two
characters in the common greeting that comes across in toneless pinyin
as "ni hao"?

Cheers,
John

Aug 19 '06 #3
Philippe Martin wrote:
many_years_afte r wrote:
>Hi,everyone:

Have you any ideas?

Say whatever you know about this.
thanks.
Hi,

You mean unicode I assume:
http://www.rikai.com/library/kanjita....unicode.shtml

Regards,

Philippe
Hi,

I have received a personnal email on this:

Kanji is indeed a Japanese subset of the Chinese Character set.

I just thought it would be relevant as it includes ~47000 characters.

If I hurt any feeling, sorry.

Regards,

Philippe

Aug 19 '06 #4
hi:

what I want to do is just to make numbers as people input some Chinese
character(hanzi ,i mean).The same character will create the same
number.So I think ascii code can do this very well.

John Machin wrote:
many_years_afte r wrote:
Hi,everyone:

Have you any ideas?

Say whatever you know about this.

Perhaps you had better explain what you mean by "ascii code of Chinese
characters". Chinese characters ("hanzi") can be represented in many
ways on a computer, in Unicode as well as many different "legacy"
encodings, such as GB, GBK, big5, two different 4-digit telegraph
codes, etc etc. They can also be spelled out in "roman" letters with or
without tone indications (digits or "accents") in the pinyin system --
is that what you mean by "ascii code"?

Perhaps you might like to tell us what you want to do in Python with
hanzi and "ascii codes", so that we can give you a specific answer.
With examples, please -- like what are the "ascii codes" for the two
characters in the common greeting that comes across in toneless pinyin
as "ni hao"?

Cheers,
John
Aug 19 '06 #5
In <11************ **********@i42g 2000cwa.googleg roups.com>,
many_years_afte r wrote:
what I want to do is just to make numbers as people input some Chinese
character(hanzi ,i mean).The same character will create the same
number.So I think ascii code can do this very well.
No it can't. ASCII doesn't contain Chinese characters.

http://en.wikipedia.org/wiki/ASCII

Ciao,
Marc 'BlackJack' Rintsch
Aug 19 '06 #6
* many_years_afte r (2006-08-19 12:18 +0100)
Hi,everyone:

Have you any ideas?

Say whatever you know about this.
contradictio in adiecto
Aug 19 '06 #7
On 2006-08-19 12:42:31, Marc 'BlackJack' Rintsch wrote:
many_years_afte r wrote:
>what I want to do is just to make numbers as people input some Chinese
character(hanz i,i mean).The same character will create the same
number.So I think ascii code can do this very well.

No it can't. ASCII doesn't contain Chinese characters.
Well, ASCII can represent the Unicode numerically -- if that is what the OP
wants. For example, "U+81EC" (all ASCII) is one possible -- not very
readable though <g-- representation of a Hanzi character (see
http://www.cojak.org/index.php?funct...kup&term=81EC).

(I don't know anything about Hanzi or Mandarin... But that's Unicode, so
this works :)

Gerhard

Aug 19 '06 #8
Gerhard Fiedler wrote:
Well, ASCII can represent the Unicode numerically -- if that is what the OP
wants.
No. ASCII characters range is 0..127 while Unicode characters range is
at least 0..65535.
For example, "U+81EC" (all ASCII) is one possible -- not very
readable though <g-- representation of a Hanzi character (see
http://www.cojak.org/index.php?funct...kup&term=81EC).
U+81EC means a Unicode character which is represented by the number
0x81EC. There are some encodings defined which map Unicode sequences
to byte sequences: UTF-8 maps Unicode strings to sequences of bytes in
the range 0..255, UTF-7 maps Unicode strings to sequences of bytes in
the range 0..127. You *could* read the latter as ASCII sequences
but this is not correct.

How to do it in Python? Let chinesePhrase be a Unicode string with
Chinese content. Then

chinesePhrase_7 bit = chinesePhrase.e ncode('utf-7')

will produce a sequences of bytes in the range 0..127 representing
chinesePhrase and *looking like* a (meaningless) ASCII sequence.

chinesePhrase_1 6bit = chinesePhrase.e ncode('utf-16be')

will produce a sequence with Unicode numbers packed in a byte
string in big endian order. This is probably closest to what
the OP wants.

Peter Maas, Aachen
Aug 19 '06 #9

many_years_afte r wrote:
John Machin wrote:
many_years_afte r wrote:
Hi,everyone:
>
Have you any ideas?
>
Say whatever you know about this.
>
Perhaps you had better explain what you mean by "ascii code of Chinese
characters". Chinese characters ("hanzi") can be represented in many
ways on a computer, in Unicode as well as many different "legacy"
encodings, such as GB, GBK, big5, two different 4-digit telegraph
codes, etc etc. They can also be spelled out in "roman" letters with or
without tone indications (digits or "accents") in the pinyin system --
is that what you mean by "ascii code"?

Perhaps you might like to tell us what you want to do in Python with
hanzi and "ascii codes", so that we can give you a specific answer.
With examples, please -- like what are the "ascii codes" for the two
characters in the common greeting that comes across in toneless pinyin
as "ni hao"?

Cheers,
John
hi:

what I want to do is just to make numbers as people input some Chinese
character(hanzi ,i mean).The same character will create the same
number.So I think ascii code can do this very well.
*What* characters make *what* numbers? Stop thinking and give us some
*examples*

Aug 19 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6896
by: K | last post by:
I've an XML file in UTF-8. It contains some chinese characters ( both simplified chinese and traditional chinese). In loading the XML file with MSXML parser, I used the below code to retrieve the data in a node. The CString was then display in CListCtrl. For the traditional chinese characters, they were shown correctly, but for simplified characters, I encounted many "?", but some characters were correct.
1
2170
by: wtistang | last post by:
I need some suggestions regarding a problem I am facing. I have a web page (asp.net and C#) which containing Chinese characters. In my web.config file I have: <globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" fileEncoding="iso-8859-1" />
7
4299
by: c.verma | last post by:
I have a web application. There is a page which has a datagrid on it.The datagrid displays the data that comes from SAP. SAP sends the chinese characters to this grid. Before I display CHinese charactes, I have to use the following code to let it display on the web page: Public Function ToSCUnicode(ByVal str As String) As String Dim enc1252 As System.Text.Encoding = System.Text.Encoding.GetEncoding(1252) Dim arrByte_GBK As Byte() Dim...
1
2459
by: lyudmilal | last post by:
I have a list of last names that can be in different languages: chinese, english, russian, german, etc. Different format need to be applied only for last names in chinese. For this purpose, I need to check if last name contains chinese characters. Any ideas how to do it (it should be data related check)? Thank you, Ludmila
0
3704
by: st.frey | last post by:
I've got a problem with importing chinese characters into a mysql-table and have read several mailings but didn't find a solution. i have a utf-8 text file that contains chinese characters. the table where i want to import the data using "load data local infile" has collation utf8_unicode_ci. but after the import is done, the chinese characters are converted into so strange characters. to show the chinese symbols in a php-script i use...
5
8540
by: Figmo | last post by:
I'm having a problem working with foreign characters (well....foreign to me anyway) I have a textbox control on a form. The font is set to MS Arial Unicode. If I use the Chinese input method I can type characters into this box no problem. They display correctly. I can also copy and paste Chinese characters from web sites into this text box and they display no problem. Here is my problem. If I put some Chinese characters in the...
13
3910
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
1070
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
2
6710
by: Flying Kite | last post by:
Hi All, I want to know how to print chinese characters on Zebra Printer, following code working fine with English string, but it's not working for Chinese string. It shows ASCII characters instead of Chinese characters, on my machine I installed language pack and currently set language as Chinese PRC but still it's not working. Option Explicit Private Type DOCINFO pDocName As String pOutputFile As String pDatatype As String
0
8568
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8504
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
9042
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8922
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7581
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 project—planning, coding, testing, and deployment—without 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
6429
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
4519
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2195
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1921
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.