Unicode failure

D'Arcy J.M. Cain darcy at VybeNetworks.com
Fri Dec 4 13:07:38 EST 2015


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 <module>
 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 at Vex.Net VoIP: sip:darcy at VybeNetworks.com


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /