How to get the ascii code of Chinese characters?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fredrik Lundh

    #16
    Re: How to get the ascii code of Chinese characters?

    many_years_afte r wrote:
    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.
    assuming you mean "code point" rather than "ASCII code" (ASCII is a
    specific encoding that *doesn't* include Chinese characters), "ord" is
    what you want:

    char = read_from_some_ input_device()
    code = ord(char)

    see:



    </F>

    Comment

    • Lawrence D'Oliveiro

      #17
      Re: How to get the ascii code of Chinese characters?

      In message <mailman.9565.1 156064188.27775 .python-list@python.org >, Fredrik
      Lundh wrote:
      Gerhard Fiedler wrote:
      >
      >>No. ASCII characters range is 0..127 while Unicode characters range is
      >>at least 0..65535.
      >>
      >Actually, Unicode goes beyond 65535.
      >
      you may want to look up "at least" in a dictionary.
      Maybe you need to do the same for "actually".

      Comment

      • Gerhard Fiedler

        #18
        Re: How to get the ascii code of Chinese characters?

        On 2006-08-20 05:56:05, Fredrik Lundh wrote:
        >>No. ASCII characters range is 0..127 while Unicode characters range is
        >>at least 0..65535.
        >>
        >Actually, Unicode goes beyond 65535.
        >
        you may want to look up "at least" in a dictionary.
        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.

        Gerhard

        Comment

        • Fredrik Lundh

          #19
          Re: How to get the ascii code of Chinese characters?

          Gerhard Fiedler wrote:
          >>Actually, Unicode goes beyond 65535.
          >>
          >you may want to look up "at least" in a dictionary.
          >
          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.
          do you know anything about how Unicode is used in real life, or are you
          just squabbling ?

          </F>

          Comment

          • Gerhard Fiedler

            #20
            Re: How to get the ascii code of Chinese characters?

            On 2006-08-20 10:31:20, Fredrik Lundh wrote:
            >"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.
            >
            do you know anything about how Unicode is used in real life, or are you
            just squabbling ?
            Your point is?

            Gerhard

            Comment

            Working...