Skip to main content
Inspiring
June 12, 2008
Answered

Problems with Replace

  • June 12, 2008
  • 4 replies
  • 582 views
I am using a cfc to create an XML page that Ajax can use to display our products. Some of the product names contain special characters such as ®, which XML can't display. How do I strip those characters out so that the products will display?

I have tried this: <cfset products_name = Replace(products_name, "®", " ", "ALL")>. But this is not working as expected. Any suggestions?
    This topic has been closed for replies.
    Correct answer EnergyFed
    Ok, I figured it out. It wasn't the Replace expression, but it was the variable name that I used, which was the same name as the query column name.. Thanks for helping!

    4 replies

    EnergyFedAuthorCorrect answer
    Inspiring
    June 12, 2008
    Ok, I figured it out. It wasn't the Replace expression, but it was the variable name that I used, which was the same name as the query column name.. Thanks for helping!
    EnergyFedAuthor
    Inspiring
    June 12, 2008
    Yeah, I tried the XMLformat() function and it didn't work.

    Dan, how would you use a regular expression to restrict the content? I've looked at the live docs, and I can't see what I am doing wrong..
    Inspiring
    June 12, 2008
    EnergyFed wrote:
    > I am using a cfc to create an XML page that Ajax can use to display our
    > products. Some of the product names contain special characters such as ?,
    > which XML can't display. How do I strip those characters out so that the
    > products will display?
    >
    > I have tried this: <cfset products_name = Replace(products_name, "?", " ",
    > "ALL")>. But this is not working as expected. Any suggestions?
    >

    Have you tried the XMLformat() function?
    Inspiring
    June 12, 2008
    use regular expressions to restrict the content to just the characters you want.