RE: 'ascii' codec can't encode character u'\xf3'

Discussion in 'Python' started by Ben Last, Aug 17, 2004.

  1. Ben Last

    Ben Last Guest

    > if i use
    > #! /usr/bin/env python
    > # -*- coding: UTF-8 -*-
    > at the begginnig of my every script, the example above still has to
    > be converted -- because of the iso-8859-1 you use in "Löwis"?

    Be aware that if you declare the encoding as UTF-8, you should really make
    sure that you're using an editor that understands UTF-8; not all the
    characters you might type freely (or copy and paste) are the same in UTF8
    and Latin-1. For example, if you inadvertently paste an ellipsis (...),
    which is \x85 in Western-Europe Windows into such a file, then you may get
    errors, since the ellipsis in Unicode is a different code altogether.

    The first "page" of UTF-8 maps exactly to ISO-Latin-1 (ISO-8859-1), but
    since you're using a Czech locale, I'd expect you to be using Latin-2, and
    for your editors to enter characters as Latin-2.

    regards
    ben
     
    Ben Last, Aug 17, 2004
    #1
    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. oziko
    Replies:
    1
    Views:
    530
    Leif K-Brooks
    Aug 17, 2004
  2. Martin Slouf
    Replies:
    6
    Views:
    943
    Martin Slouf
    Aug 18, 2004
  3. oziko
    Replies:
    2
    Views:
    11,487
    Diez B. Roggisch
    Aug 17, 2004
  4. thomas Armstrong

    'ascii' codec can't encode character u'\u2013'

    thomas Armstrong, Sep 30, 2005, in forum: Python
    Replies:
    3
    Views:
    4,493
    John J. Lee
    Sep 30, 2005
  5. Fredrik Lundh
    Replies:
    0
    Views:
    1,807
    Fredrik Lundh
    Sep 30, 2005
Loading...

Share This Page