Skip to main content
January 20, 2009
Question

Dealing with UTF-16 form input with CF5

  • January 20, 2009
  • 2 replies
  • 655 views
Hello, this question is for veteran 😉

Sometimes accented characters entered in a textarea field are replaced with strange characters when recorded in my MS Access memo field, For exemple "©" instead of “é”.

For debugging purpose, I used CFFile to record the same field value in a .txt file. When open with notepad, the accented characters are displayed correctly, but the HEX values contained in the file seem to indicate UTF-16 Little Indian. The file start with "FF FE" and the other characters have the form "XX 00".

Considering I’m with CF5 and it can’t be upgraded, my question is:

Is there a way (with CF5) that I can prevent the field to contain anything else that ISO-8859-1?

By parsing the characters? Using Access? Any other ideas?

I have this tag to set the encoding of the form page:
<cfcontent type="text/html; charset=ISO-8859-1" reset="yes">

Thanks!
This topic has been closed for replies.

2 replies

Participating Frequently
January 22, 2009
Check out this link; note that I think it was written for CF8 so you may have to do some downgrading in the script (I didn't review the whole thing myself)

http://www.bennadel.com/blog/1155-Cleaning-High-Ascii-Values-For-Web-Safeness-In-ColdFusion.htm
Inspiring
January 21, 2009
edelagrave2 wrote:
> Sometimes accented characters entered in a textarea field are replaced with
> strange characters when recorded in my MS Access memo field, For exemple "©"
> instead of ?�?.

cf5 doesn't know charsets from a hole in the ground so there's not much you can do.

if you don't care at all about those chars, just strip out any chars w/code
point values > 256. otherwise something like this:

http://www.cflib.org/index.cfm?event=page.udfbyid&udfid=725
January 21, 2009
Hello,

Thanks for your reply. I tried Demorozine, on reading file, database field or before saving the field but without result.

You’re suggesting to “just strip out any chars w/code point values > 256”.
How would you do that?

Thanks!