Unicode Hell

S

Stuart

I'm trying to do something seemingly easy yet it is proving incredibly
frustrating. Perhaps it is due to my relatively new acquaintance with
Python. In a web environment (ASP with python scripting) I have one form
posting information to another form. The contents of the posting variable
(lets call it cVal1 for simplicity) is non ascii characters, lets say éêëìû
for example.



On the second page a simple:



cVal1 = Request("cVal1 ")

Response.Write(cVal1)



Writes the values to the screen correctly.



What I really want to do is replace a field place holder with those values.



So if we have a string



cReplaceString = "I want to replace #here#"



I'd like to replace the #here# with the values of a (or éêëìû)



Please help



Regards



Stuart
 
P

Peter Maas

Stuart said:
What I really want to do is replace a field place holder with those values.
So if we have a string
cReplaceString = "I want to replace #here#"
I'd like to replace the #here# with the values of a (or Óçâß)

# assign a unicode literal (u"...") to cReplaceString:
cReplaceString = u"I want to replace #here#"
cNewString = cReplaceString.replace(u"#here#",u"Óçâß")

Perhaps you have to ecncode the chineses characters like \uabcd
whith a,b,c,d as hex digits. My editor has problems with chinese
characters.

Mit freundlichen Gruessen,

Peter Maas
 

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

Similar Threads


Members online

Forum statistics

Threads
474,169
Messages
2,570,920
Members
47,462
Latest member
ChanaLipsc

Latest Threads

Top