ascii coding / decoding problem

25 views
Skip to first unread message

Fidel N

unread,
Dec 23, 2014, 12:59:55 PM12/23/14
to leo-e...@googlegroups.com
Hey everyone:
having some problems trying to do some simple stuff.

Im trying to run this script, with no success:

@first # -*- coding: utf-8 -*-.

c
.p.b = c.p.b + "Ñ"


I tried encoding the "Ñ" and some more things I could come up with, but still get the UnicodeDecodeError.

Anyone faced this and knows a walk around?

Fidel N

unread,
Dec 23, 2014, 1:05:57 PM12/23/14
to leo-e...@googlegroups.com
phew, long time no program in python, seems like I forgot the basics -_-

Code solution, using "u" before the "Ñ":

@first # -*- coding: utf-8 -*-.


c
.p.b = c.p.b + u"Ñ"

Edward K. Ream

unread,
Dec 24, 2014, 12:55:49 PM12/24/14
to leo-editor

​​Note that this is valid in Python 3​.3 and later:
EKR
Reply all
Reply to author
Forward
0 new messages