Unicode Hell

Robert Brewer fumanchu at amor.org
Fri Nov 7 03:37:50 EST 2003


I assume you've tried the simple solution for string substitution? :

cReplaceString = u"I want to replace %s" % cVal1

You mention Unicode, but don't say what in particular is giving you problems. If the characters are being output but look garbled, make sure you check your browser's encoding. For example, in IE6 look at the menu View->Encoding and select the encoding which matches your page. It's possible your web page does not specify the encoding, in which case you'll have to check your server to see what the default encoding is. You can hint that your web page uses a particular encoding with a tag within the head element like this:

   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org

> -----Original Message-----
> From: Stuart [mailto:stuartf at the-i-junction.com] 
> Sent: Thursday, November 06, 2003 11:45 PM
> To: python-list at python.org
> Subject: Unicode Hell
> 
> 
> 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
> 
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 





More information about the Python-list mailing list