Handing Special Characters

If you’ve ever needed to create strings containing quotes, double quotes, line feeds, less than, greater than, or other special characters, you’ve probably found it to be a less than enjoyable experience. Non-printable characters, characters that have special meanings, or characters that appear to the editor as if they were terminating tags, are all examples of characters that can complicate string processing. One simple solution is to use the Chr() function which takes the ASCII code of a character and returns the character itself. So, #Chr(13)# is a carriage return, #Chr(34)# is a double quote, and so on. And you can use these anywhere you’d display the characters themselves – screen output, database entries, e-mail, and more. (Applies to: ColdFusion All)

Leave a Reply