How to process Chinese using Python?

Discussion in 'Python' started by chad, Mar 5, 2004.

  1. chad

    chad Guest

    I don't know how to make use of the encodings and what encoding I
    should use. The PEP 0263 page is not helpful.

    Whenever I have Chinese characters in my Python code, I get this
    warning message:

    C:\Python23\codes>python stripper.py
    sys:1: DeprecationWarning: Non-ASCII character '\xc0' in file
    stripper.py on lin
    e 22, but no encoding declared; see
    http://www.python.org/peps/pep-0263.html for
    details

    when I attempt to execute it.

    It still warns even if I add

    # -*- coding: <utf-8> -*-

    to the beginning of the code, as PEP 0263 seems to have suggested.

    Any idea about processing east-asian languages, Chinese in particular?
     
    chad, Mar 5, 2004
    #1
    1. Advertising

  2. chad

    Peter Otten Guest

    chad wrote:

    > I don't know how to make use of the encodings and what encoding I
    > should use. The PEP 0263 page is not helpful.
    >
    > Whenever I have Chinese characters in my Python code, I get this
    > warning message:
    >
    > C:\Python23\codes>python stripper.py
    > sys:1: DeprecationWarning: Non-ASCII character '\xc0' in file
    > stripper.py on lin
    > e 22, but no encoding declared; see
    > http://www.python.org/peps/pep-0263.html for
    > details
    >
    > when I attempt to execute it.
    >
    > It still warns even if I add
    >
    > # -*- coding: <utf-8> -*-


    Try changing that to

    # -*- coding: utf-8 -*-

    Peter
     
    Peter Otten, Mar 5, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    7
    Views:
    6,643
    Joerg Jooss
    Feb 25, 2005
  2. Earl Eiland
    Replies:
    0
    Views:
    328
    Earl Eiland
    May 10, 2005
  3. Replies:
    1
    Views:
    434
    Fredrik Lundh
    Jun 7, 2006
  4. franckspike
    Replies:
    1
    Views:
    333
    Boris
    Jul 3, 2008
  5. linda.s
    Replies:
    2
    Views:
    78
    Wesley
    Apr 23, 2014
Loading...

Share This Page