Brenda Martinez Brenda Martinez - 1 year ago 123
Python Question

Unicode python Error

i'm trying to print : Pokémon GO Việt Nam

print u"Pokémon GO Việt Nam"

and i'm getting :

print u"PokÚmon GO Vi?t Nam"
SyntaxError: (unicode error) 'utf8' codec can't decode byte 0xe9 in position 0: unexpected end of data

i've tried :


My python version is 2.7.9 , Notepad++ UTF-8 encoding .
with no luck , how can i print it ? and i'm encountering this kind of issues all the time , what's the proper way to debug and get the right encoding ?

Answer Source
# -*- coding: utf-8 -*-

print "Pokémon GO Việt Nam"

You can find here more info

For PyCharm settings, go to the menu: PyCharm --> Preference then use the search to look up "encoding", you should reach the following screen:

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download