name = caffé
print name
Python gave me an error on print: ascii' codec can't encode character u'\xe9' in position 5: ordinal not in range(128)
pythononmac
0
Newbie Poster
Recommended Answers
Jump to PostI have put # -*- coding: utf-8 -*- on the top of the script
If you remove that line from the top of your script does it change the result?
Also, have you tried utf-16 ?
Jump to PostPerhaps you should check this link http://drj11.wordpress.com/2007/05/14/python-how-is-sysstdoutencoding-chosen/ and change the environment variable LC_CTYPE (you should also check if you can change it in your program, using
os.environ
). I can't test your problem …
All 7 Replies
pythononmac
0
Newbie Poster
jlm699
320
Veteran Poster
pythononmac
0
Newbie Poster
Gribouillis
1,391
Programming Explorer
Team Colleague
jice
53
Posting Whiz in Training
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
pythononmac
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.