Skip to main content
Participant
March 11, 2010
Question

How to replace special characters with html code characters automatically?

  • March 11, 2010
  • 1 reply
  • 1119 views

A colleague and I work on these html pages. They eventually end up as emails, but we have the cold fusion server to pre process them. One thing we are trying to do is eliminate problems caused by unencoded copyright, trademark and smart quote symbols.


How could I create an array of find / replace commands in the header so it processes the HTML with correct character codes.

I"m not cold fusion aware, so any kind of starter info would be great. Eventually I might add more replacements to the array.

As an example TM (font character) would process to ™ and a smart quote or apostrophe would process to a straight one. an en dash character would become –

Because we copy paste from places, this often happens and it seems like cold fusion could solve the problem quickly and repeatedly all at once.

thanks for any help

-smick

    This topic has been closed for replies.

    1 reply

    Inspiring
    March 11, 2010

    CF has a built in HTMLEditFormat function for handling <  &  > characters.  For handling trademark and smart quote characters you might try searching for a user defined function at http://cflib.org or writing a user defined function yourself that will handle the specific characters needed in your application.