Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58182
| References | <CAFEUn8bJ=KuTbcBHSMaQhQMDtN3VEB26fdCSEzGSeSjUzSqtOA@mail.gmail.com> |
|---|---|
| Date | 2013-11-01 02:06 +1100 |
| Subject | Re: tuple __repr__ non-ascii characters |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1881.1383232009.18130.python-list@python.org> (permalink) |
On Fri, Nov 1, 2013 at 1:59 AM, Yaşar Arabacı <yasar11732@gmail.com> wrote: > Is there a better way to handle this problem? There is, but I don't know how easy it'll be. In Python 3, the repr of a tuple will show Unicode strings as Unicode. :) For what you're showing there, I'm not actually quite sure what's going on. Is the string a Unicode string, or a byte string? If it's a byte string (which I suspect, since it's coming up as \xfe and the character you're showing us isn't U+00FE), then you have to worry about encodings. If you're using it to store non-ASCII data, you probably want to be using a Unicode string: a = u"yaşar" The best solution is definitely to move to Python 3, though - if you can. Do you have much code to migrate, or are you starting fresh? Are there any libraries/modules that you need that don't support Py3? ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: tuple __repr__ non-ascii characters Chris Angelico <rosuav@gmail.com> - 2013-11-01 02:06 +1100
csiph-web