Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35009

Re: Unicode

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <vlastimil.brom@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'configure': 0.04; 'string.': 0.04; '"""': 0.05; 'context': 0.05; 'error:': 0.05; 'say,': 0.05; 'reason,': 0.07; 'encode': 0.09; 'encoding.': 0.09; '2.7': 0.13; 'encoding': 0.15; 'inserting': 0.16; 'subject:Unicode': 0.16; 'string,': 0.17; 'unicode': 0.17; 'enabled,': 0.22; "i've": 0.23; 'script': 0.24; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'looks': 0.26; 'creating': 0.26; 'setting': 0.26; 'experiences': 0.27; 'message- id:@mail.gmail.com': 0.27; 'options': 0.27; 'there.': 0.28; 'fixed': 0.28; 'run': 0.28; 'url:mailman': 0.29; 'character': 0.29; 'this.': 0.29; "i'm": 0.29; 'maybe': 0.29; 'e.g.': 0.30; 'error': 0.30; 'url:python': 0.32; 'could': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'changed': 0.34; 'received:google.com': 0.34; 'whatever': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'data.': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'gives': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'url:mail': 0.40; 'your': 0.60; 'more': 0.63; 'yours': 0.88
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=GkPh7kQI7f971laCr2kKCjBQTHUI0kTU9iABYZ8vxSw=; b=z8HTmB5i1KFE/5wzkstYq5o0XSOF8ypvCHePOChuoegJUaL3QG1e/l/yreNPYjXtFo avzDt95eg6ErvLUrIdz8G35mWG+CGvcgxrunUbh6vbaUk+djoJ2k0sW/8xHzEfON2nvb baOLkRLDxN+Jpt/m31A/Kuou6hkWGfAX7H6fEhDYwQ5ernkma1HSl/o4gD8Ze18cuXYX Ba6hgd1d1yIIxUz6DdrAYhy8c78RxPXNCsLdHPtMN2mA/oyn8k/IbcyRnP8sb4ofKlJp YnpEg+w9AxmlHGY9NqcP/0DjKxHcyAMYA4lA2qP6fpqdbwNuq//ZEZVP4WHcc1KiPlpf uL8g==
MIME-Version 1.0
In-Reply-To <CAKhY55NQ4NsQEyP2hbJy4RV=K8M9QSp0-gsQqGNQA5BjH3wJsQ@mail.gmail.com>
References <mailman.941.1355692240.29569.python-list@python.org> <50ceb674$0$29868$c3e8da3$5496439d@news.astraweb.com> <CAKhY55MLBeT-xLwqy59gusU3H2o_pceLKDxY-8XVifU_Ns2yrg@mail.gmail.com> <CAMuTYXis2vH5xjmHAgrESquPDQsAYWkzFnWGfDeyE9K5-Nwiww@mail.gmail.com> <CAKhY55OE+FdjR-EyXToE5TuWEMLwAi4n-NeuFhtKnOtZ=ey2DA@mail.gmail.com> <CAHzaPEM_sp=0aEtbxVPYYvea=_DuE36P9ZwtNGAVjnXCaykNaw@mail.gmail.com> <CAKhY55P3x9-WS52D5i+E+rJ7y2osGHnqTZwB2TpBK4zUSe0ouw@mail.gmail.com> <CAHzaPEPigppu_OGO+oujXJXNxtq++GeQcPAqOPnwfegC8dE+Tg@mail.gmail.com> <CAKhY55PdHrbqOw=3Gp3Pva57sAYrHuh5pFwy5mOSLFnV0ekoig@mail.gmail.com> <CAHzaPEMECAgRhgWro0mMn4UtimYL6NQX1FFASEvm5dqr5krXyA@mail.gmail.com> <CAKhY55MHefj=RjThxacsdsd8NJoC7WmVzYkahObrgCuA2SMuFg@mail.gmail.com> <50CF5F72.90402@davea.name> <CAKhY55NQ4NsQEyP2hbJy4RV=K8M9QSp0-gsQqGNQA5BjH3wJsQ@mail.gmail.com>
Date Mon, 17 Dec 2012 20:55:03 +0100
Subject Re: Unicode
From Vlastimil Brom <vlastimil.brom@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.987.1355774107.29569.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1355774107 news.xs4all.nl 6951 [2001:888:2000:d::a6]:52939
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:35009

Show key headers only | View raw


2012/12/17 Anatoli Hristov <tolidtm@gmail.com>:
>> src.decode() is creating a unicode string.  The error is not happening
>> there.  But when print is used with a unicode string, it has to encode
>> the data.  And for whatever reason, yours is using latin-1, and you have
>> a character in there which is not in the latin-1 encoding.
> I fixed the print, I changed the setting of the terminal and also on
> the sshconfig, so now when I print I'm able to print out without
> problems, but when I tried to run the script I've made it gives me
> again the same error :
> ""Unexpected error: exceptions.UnicodeEncodeError
> """
> Maybe I will try to update to 2.7
> --
> http://mail.python.org/mailman/listinfo/python-list

Well, we don't see the context or traceback of that error, but it
looks like a mysql error on inserting data.
Could it be, that your database is not unicode enabled, e.g. utf-8,
but, say, latin-1?
I don't have experiences with this database this, but I guess, there
must be some configure options for this.
Would maybe setting the encoding in db.connect(...) work?
cf.:
http://stackoverflow.com/questions/8365660/python-mysql-unicode-and-encoding

Hopefully, others might give more reliable suggestions..

hth,
  vbr

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Unicode Anatoli Hristov <tolidtm@gmail.com> - 2012-12-16 22:10 +0100
  Re: Unicode Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-17 06:06 +0000
    Re: Unicode Anatoli Hristov <tolidtm@gmail.com> - 2012-12-17 09:59 +0100
    Re: Unicode Benjamin Kaplan <benjamin.kaplan@case.edu> - 2012-12-17 01:28 -0800
    Re: Unicode Anatoli Hristov <tolidtm@gmail.com> - 2012-12-17 10:45 +0100
    Re: Unicode Vlastimil Brom <vlastimil.brom@gmail.com> - 2012-12-17 11:02 +0100
    Re: Unicode Anatoli Hristov <tolidtm@gmail.com> - 2012-12-17 11:17 +0100
    Re: Unicode Vlastimil Brom <vlastimil.brom@gmail.com> - 2012-12-17 11:55 +0100
    Re: Unicode Anatoli Hristov <tolidtm@gmail.com> - 2012-12-17 12:14 +0100
    Re: Unicode Vlastimil Brom <vlastimil.brom@gmail.com> - 2012-12-17 12:56 +0100
    Re: Unicode Anatoli Hristov <tolidtm@gmail.com> - 2012-12-17 18:43 +0100
    Re: Unicode Dave Angel <d@davea.name> - 2012-12-17 13:07 -0500
    Re: Unicode Anatoli Hristov <tolidtm@gmail.com> - 2012-12-17 19:36 +0100
      Re: Unicode Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-18 00:07 +0000
    Re: Unicode Vlastimil Brom <vlastimil.brom@gmail.com> - 2012-12-17 20:55 +0100
    Re: Unicode Anatoli Hristov <tolidtm@gmail.com> - 2012-12-17 21:00 +0100
    Re: Unicode Dave Angel <d@davea.name> - 2012-12-17 16:09 -0500
      Re: Unicode Hans Mulder <hansmu@xs4all.nl> - 2012-12-17 23:02 +0100
        Re: Unicode Anatoli Hristov <tolidtm@gmail.com> - 2012-12-17 23:33 +0100
    Re: Unicode Terry Reedy <tjreedy@udel.edu> - 2012-12-17 17:03 -0500
    Re: Unicode Anatoli Hristov <tolidtm@gmail.com> - 2012-12-17 23:31 +0100

csiph-web