Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "D'Arcy J.M. Cain" Newsgroups: comp.lang.python Subject: Unicode failure Date: Fri, 4 Dec 2015 13:07:38 -0500 Organization: Vybe Networks Inc. Lines: 27 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de /70OKAlmbzuJzK39Vm7KKQ2w31wxLk3/LWas72JkGW1w== Return-Path: 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; 'sys': 0.05; '-*-': 0.07; 'skip:/ 10': 0.07; 'utf-8': 0.07; 'coding:': 0.09; 'encode': 0.09; 'python': 0.10; 'codec': 0.16; 'missing?': 0.16; 'ordinal': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'stuff.': 0.16; 'subject:Unicode': 0.16; 'script.': 0.18; 'seems': 0.23; 'import': 0.24; '(most': 0.24; 'character': 0.29; "can't": 0.32; 'traceback': 0.33; 'file': 0.34; 'unicode': 0.35; 'skip:p 30': 0.35; 'but': 0.36; 'to:addr:python-list': 0.36; 'thought': 0.37; 'charset:us-ascii': 0.37; 'to:addr:python.org': 0.40; 'mark': 0.40; 'still': 0.40; 'skip:u 10': 0.61; 'here': 0.66; '3.4': 0.84; 'received:98.158': 0.84 X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) X-Mailman-Approved-At: Fri, 04 Dec 2015 17:32:44 -0500 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:100013 I thought that going to Python 3.4 would solve my Unicode issues but it seems I still don't understand this stuff. Here is my script. #! /usr/bin/python3 # -*- coding: UTF-8 -*- import sys print(sys.getdefaultencoding()) print(u"\N{TRADE MARK SIGN}") And here is my output. utf-8 Traceback (most recent call last): File "./g", line 5, in print(u"\N{TRADE MARK SIGN}") UnicodeEncodeError: 'ascii' codec can't encode character '\u2122' in position 0: ordinal not in range(128) What am I missing? TIA. -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.VybeNetworks.com/ IM:darcy@Vex.Net VoIP: sip:darcy@VybeNetworks.com