• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Dealing with UTF-16 form input with CF5

Guest
Jan 20, 2009 Jan 20, 2009

Copy link to clipboard

Copied

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!
TOPICS
Advanced techniques

Views

502

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 20, 2009 Jan 20, 2009

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 21, 2009 Jan 21, 2009

Copy link to clipboard

Copied

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 21, 2009 Jan 21, 2009

Copy link to clipboard

Copied

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

what does that mean?

can we see the data? is there a public site i can look at?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 22, 2009 Jan 22, 2009

Copy link to clipboard

Copied

LATEST
Thanks guys, I partially found the source of the problem: It's because i'm using javascript (jQuery) to post the form (AJAX). Using LiveHTTPheaders, I noticed that the post actually occurs in UTF-8 instead of ISO-8859-1, despite that the page is explicitly set in ISO-8859-1.

Anybody found a way to deal with this problem?

According to a friend, it's unavoidable. He suggest to encode the string in HEX with a function, and then decode back on the server side.

I'm just thinking that I can't be the only one to have that problem! ;-)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 21, 2009 Jan 21, 2009

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation