Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'cpython': 0.05; 'things.': 0.05; 'ascii': 0.07; 'character,': 0.07; 'mentioned,': 0.07; 'python': 0.09; 'encoding.': 0.09; 'subject:characters': 0.09; 'encoding': 0.15; 'wrote:': 0.17; 'bytes': 0.17; 'windows': 0.19; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'guess': 0.27; 'question': 0.27; 'statements': 0.29; "i'm": 0.29; 'received:209.85.210.174': 0.30; 'could': 0.32; 'raising': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'wrong': 0.34; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'message-id:@gmail.com': 0.36; 'characters': 0.36; 'display': 0.36; 'two': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'header:Received:5': 0.40; 'range': 0.60; 'skip:6 10': 0.63; 'different': 0.63; 'returns.': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=PH1TR9csUk/um+vVdD+OSQLLuo0otNZYNBa8/+M7aAo=; b=TS9mgdwjOy4EL+Z5zbyCx/rfk704ajh3bGvJFqR8vo3DRZrVxQ3ySo0mRf9tyaPl/x UhNn+Rk53JjBL/6sHt9Eg034x3IRJqGlCufJRienOLiAXh93LeIcYCRulxocVsoVRN3t pQ0/IToVQYDEeep8fUlb0Imi16pirk3Ed3I/OrKNOFzK8CWNPa6Wsscy7ZoIHrVpqEvn 7XT7GK/wdXGVI++r/zywT9f2VN1dhJrnPEe06vUyG2uIZ0On/q7sDADujJH1DQnRK5p5 HRdQnTCweBUunrA4F3eA1qwwYbB04gT5va6ssa0ZXR016mfCWE49iKkhDVFfqXeykDFh p2cQ== Date: Fri, 09 Nov 2012 15:39:13 -0600 From: Andrew Berg User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: "comp.lang.python" Subject: Re: Printing characters outside of the ASCII range References: <3d4644f8-ab88-41c5-9a52-2a5678dd64c0@googlegroups.com> <99d5bd83-35ab-4801-b953-391c497c35bf@googlegroups.com> In-Reply-To: <99d5bd83-35ab-4801-b953-391c497c35bf@googlegroups.com> X-Enigmail-Version: 1.4.5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1352497164 news.xs4all.nl 6911 [2001:888:2000:d::a6]:40612 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33055 On 2012.11.09 15:17, danielk wrote: > I guess the question I have is: How do you tell Python to use a specific encoding for 'print' statements when I know there will be characters outside of the ASCII range of 0-127? You don't. It's raising that exception because the terminal cannot display that character, not because it's using the wrong encoding. As Ian mentioned, chr() on Python 2 and chr() on Python 3 return two different things. I'm not very familiar with the oddities of Python 2, but I suspect sending bytes to the terminal could work since that is what chr() on Python 2 returns. -- CPython 3.3.0 | Windows NT 6.1.7601.17835