Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; 'subject:Python': 0.05; 'encode': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'tcl/tk': 0.09; 'terry': 0.09; 'unicode,': 0.09; '(the': 0.15; 'codec': 0.16; 'fine.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:Problem': 0.16; 'subject:Unicode': 0.16; 'wrote:': 0.17; 'char': 0.17; 'widget': 0.17; 'jan': 0.18; '>>>': 0.18; 'windows': 0.19; 'skip:" 40': 0.20; '"",': 0.22; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'creating': 0.26; 'supported': 0.26; '(most': 0.27; 'am,': 0.27; 'header:X -Complaints-To:1': 0.28; 'character': 0.29; 'file': 0.32; 'message.': 0.33; 'idle': 0.33; 'traceback': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; "can't": 0.34; 'text': 0.34; 'especially': 0.35; 'received:org': 0.36; 'but': 0.36; 'subject:with': 0.36; 'problems': 0.36; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'skip:u 10': 0.60; 'is.': 0.62; 'different': 0.63; 'skip:c 50': 0.66; 'brand': 0.78; '<<<': 0.84; 'ion': 0.84; 'received:fios.verizon.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Problem with Unicode char in Python 3.3.0 Date: Mon, 07 Jan 2013 08:12:57 -0500 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: 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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357564437 news.xs4all.nl 6930 [2001:888:2000:d::a6]:35005 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36348 On 1/7/2013 7:57 AM, Franck Ditter wrote: > <<< print('\U0001d11e') > Traceback (most recent call last): > File "", line 1, in > print('\U0001d11e') > UnicodeEncodeError: 'UCS-2' codec can't encode character '\U0001d11e' > in position 0: Non-BMP character not supported in Tk The message comes from printing to a tk text widget (the IDLE shell), not from creating the 1 char string. c = '\U0001d11e' works fine. When you have problems with creating and printing unicode, *separate* creating from printing to see where the problem is. (I do not know if the brand new tcl/tk 8.6 is any better.) The windows console also chokes, but with a different message. >>> c='\U0001d11e' >>> print(c) Traceback (most recent call last): File "", line 1, in File "C:\Programs\Python33\lib\encodings\cp437.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_map)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\U0001d11e' in posit ion 0: character maps to Yes, this is very annoying, especially in Win 7. -- Terry Jan Reedy