Unicode Hell

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stuart

    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


  • Peter Maas

    #2
    Re: Unicode Hell

    Stuart schrieb:[color=blue]
    > 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 Óçâ߁)[/color]

    # 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

    --
    -------------------------------------------------------------------
    Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
    Tel +49-241-93878-0 Fax +49-241-93878-20 eMail peter.maas@mplu sr.de
    -------------------------------------------------------------------


    Comment

    Working...