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


Groups > comp.lang.python > #62793

Re: unicode to human readable format

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'represents': 0.05; '[0]': 0.09; 'encode': 0.09; 'next,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'codec': 0.16; 'help?': 0.16; 'ordinal': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 's[0]': 0.16; 'stdout': 0.16; 'subject:format': 0.16; 'subject:unicode': 0.16; 'wrote:': 0.18; 'python?': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'please?': 0.24; 'first,': 0.26; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'point': 0.28; 'characters': 0.30; 'dec': 0.30; 'code': 0.31; 'os,': 0.31; 'fri,': 0.33; "can't": 0.35; 'version': 0.36; 'like,': 0.36; 'handle': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'solve': 0.60; 'tell': 0.60; 'email addr:gmail.com': 0.63; 'finally': 0.65; 'bottom': 0.67; 'convinced': 0.93; '2013': 0.98
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dave Angel <davea@davea.name>
Subject Re: unicode to human readable format
Date Fri, 27 Dec 2013 06:59:58 -0500
References <f6f3d6e9-d0f5-4c06-8f15-42aabf149473@googlegroups.com> <7f0f59ef-5a9e-4c6b-832a-dfaee3ee4dcf@googlegroups.com>
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host dpc6744192029.direcpc.com
In-Reply-To <7f0f59ef-5a9e-4c6b-832a-dfaee3ee4dcf@googlegroups.com>
User-Agent Groundhog Newsreader for Android
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4664.1388145522.18130.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1388145522 news.xs4all.nl 2928 [2001:888:2000:d::a6]:59231
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62793

Show key headers only | View raw


On Fri, 27 Dec 2013 02:43:58 -0800 (PST), tomasz.kaczorek@gmail.com 
wrote:
> can I ask you for help? when I try to print s[0] i vane the 
message: UnicodeEncodeError: 'ascii' codec can't encode characters in 
position 0-1: ordinal not in range(128). 
> how to solve my problem, please?

First, what version of what os, and what version of python? 

Next,  what terminal are you running,  or what ide, and do you have 
stdout redirected? 

Finally what does your program look like, or at least tell us the 
type and represents of s [0].

Bottom line is that s [0] contains a code point that's larger than 7f 
and print is convinced that your terminal can handle only ASCII.

-- 
DaveA

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


Thread

unicode to human readable format tomasz.kaczorek@gmail.com - 2013-12-22 04:24 -0800
  Re: unicode to human readable format Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-12-22 13:30 +0100
  Re: unicode to human readable format Peter Otten <__peter__@web.de> - 2013-12-22 13:33 +0100
  Re: unicode to human readable format tomasz.kaczorek@gmail.com - 2013-12-27 02:43 -0800
    Re: unicode to human readable format Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-27 22:37 +1100
      Re: unicode to human readable format wxjmfauth@gmail.com - 2013-12-27 23:48 -0800
    Re: unicode to human readable format Ned Batchelder <ned@nedbatchelder.com> - 2013-12-27 06:47 -0500
    Re: unicode to human readable format Dave Angel <davea@davea.name> - 2013-12-27 06:59 -0500

csiph-web