Skip to main content
August 31, 2010
Question

Ignore special characters

  • August 31, 2010
  • 3 replies
  • 687 views

I started working on a website that pulls information from another websites database. The issue I have is the users are entering in content which breaks the whole site. There are so many users that I can't tell them all to avoid special characters. Is there any to tell ColdFusion to ingore special characters, or to read the information as just text.

    This topic has been closed for replies.

    3 replies

    August 31, 2010

    I am not entirely sure what actually broke the web page. What is being entered are just comments, nothing complicated. One post will break the web page and if you remove all quotes and punctuation that same post will work no problem.

    Inspiring
    August 31, 2010

    If the text is being copied from Microsoft Word the problem might be that single and double quotes in Word (AKA 'smart quotes') are not standard ASCII characters. You should be able to find a function at cflib.org that can find and replace these characters.

    Inspiring
    August 31, 2010

    In addition to using the functions ilssac mentioned you might search the user defined functions posted at http://www.cflib.org/ .

    You will find functions for:

    1. Removing HTML: http://www.cflib.org/udf/stripHTML

    2. Converting Microsoft Word smart quote characters to standard quotes: http://www.cflib.org/udf/ConvertSpecialChars

    It might be helpful to know what you mean by "special characters".

    ilssac
    Inspiring
    August 31, 2010

    This situation is what the various "format" functions are for.  HTMLEditFormat(), HTMLCodeFormat(), urlEncodedFormat(), XMLFormat() etc.  Use the appropiate one(s) for your needs.