unicode in multi-line strings

J

Jiri Barton

Hello,

I have a problem with international characters in multi-line strings.


Works: '''á'''

Works: '''
a'''

Does not work: '''
á'''


By does not work I mean the infamous

'ascii' codec can't encode character u'\xe1' in position 4: ordinal not
in range(128)

I'm using Ubuntu 8.04 with Python 2.5. It does not work in terminal,
from scripts, or from scripts with the encoding specified at the top.
Making the string unicode (u''' ... ''') does not change anything.

It could be an interpreter issue but I didn't know where else I should
turn for help.

Thank you!
Jiri
 
D

Diez B. Roggisch

Jiri said:
Hello,

I have a problem with international characters in multi-line strings.


Works: '''á'''

Works: '''
a'''

Does not work: '''
á'''


By does not work I mean the infamous

'ascii' codec can't encode character u'\xe1' in position 4: ordinal not
in range(128)

I'm using Ubuntu 8.04 with Python 2.5. It does not work in terminal,
from scripts, or from scripts with the encoding specified at the top.
Making the string unicode (u''' ... ''') does not change anything.

It could be an interpreter issue but I didn't know where else I should
turn for help.

Please show a self-contained example that does not work. The above won't
puke on you as you claim - because they are simple byte-strings, and thus
aren't subject to any automatic en/decoding whatsoever, unless somehow
*used*. Which you don't show how you do it.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,263
Messages
2,571,062
Members
48,769
Latest member
Clifft

Latest Threads

Top