M
many_years_after
Hi,everyone:
Have you any ideas?
Say whatever you know about this.
thanks.
Have you any ideas?
Say whatever you know about this.
thanks.
Hi,many_years_after said:Hi,everyone:
Have you any ideas?
Say whatever you know about this.
thanks.
many_years_after said:Hi,everyone:
Have you any ideas?
Say whatever you know about this.
Philippe said:Hi,
You mean unicode I assume:
http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml
Regards,
Philippe
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.
Hi,everyone:
Have you any ideas?
Say whatever you know about this.
No it can't. ASCII doesn't contain Chinese characters.
Gerhard said: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?function=code_lookup&term=81EC).
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.
No. ASCII characters range is 0..127 while Unicode characters range is
at least 0..65535.
U+81EC means a Unicode character which is represented by the number
0x81EC.
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_7bit = chinesePhrase.encode('utf-7')
will produce a sequences of bytes in the range 0..127 representing
chinesePhrase and *looking like* a (meaningless) ASCII sequence.
chinesePhrase_16bit = chinesePhrase.encode('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.
many_years_after said: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.
Well, people may input from keyboard. They input some ChineseJohn said:Possibly you have "create" upside-down. Could you possibly be talking
about an "input method", in which people type in ascii letters (and
maybe numbers) and the *result* is a Chinese character? In other words,
what *everybody* uses to input Chinese characters?
Perhaps you could ask on the Chinese Python newsgroup.
*GIVE* *EXAMPLES* of what you want to do.
Well, people may input from keyboard. They input some Chinese
characters, then, I want to create a number. The same number will be
created if they input the same Chinese characters.
many_years_after said:Well, people may input from keyboard. They input some Chinese
characters, then, I want to create a number. The same number will be
created if they input the same Chinese characters.
Gerhard said:Actually, Unicode goes beyond 65535.
many_years_after said:Well, people may input from keyboard. They input some Chinese
characters, then, I want to create a number. The same number will be
created if they input the same Chinese characters.
you may want to look up "at least" in a dictionary.
you may want to look up "at least" in a dictionary.
Gerhard said:As a homework, try to parse "at least until" and "goes beyond" and compare
the two (a dictionary is not necessarily of help with this
"range is least 0..65535" : upper_bound >= 65535
"goes beyond 65535" : upper_bound > 65535
For some discussions (like how to represent code points etc) this
distinction is crucial.
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.