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

ColdFusion Changing Spanish Characters

New Here ,
Oct 01, 2013 Oct 01, 2013

Copy link to clipboard

Copied

For some reason ColdFusion seems to be changing some spanish characters. I've narrowed it down to ColdFusion (or maybe IIS 6 scripting handler) because the text comes out fine on a plain .html file but simply changing it to .cfm causes the characters to come out incorrect. Any help would be great! Thanks

FromHTML.png

FromCF.png

P.S. The screenshots above look far better when I'm editing this post vs viewing it, not sure what's going on there.

Views

1.2K

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

correct answers 1 Correct answer

Enthusiast , Oct 01, 2013 Oct 01, 2013

First, I would ensure that you are using the proper page encoding.  You can utilize headers or override it with the <cfprocessingdirective>.  I currently use utf-8.

Secondly, how are you generating the characters?  Are you using their HTML entity codes?

For example, to output: This is an A character with a grave: À

You need to be generating:  <p>This is an A character with a grave: &agrave;</p>

You can optionally use the entity code, like: <p>This is an A character with a grave: &##224;</p>  (Note t

...

Votes

Translate

Translate
Enthusiast ,
Oct 01, 2013 Oct 01, 2013

Copy link to clipboard

Copied

First, I would ensure that you are using the proper page encoding.  You can utilize headers or override it with the <cfprocessingdirective>.  I currently use utf-8.

Secondly, how are you generating the characters?  Are you using their HTML entity codes?

For example, to output: This is an A character with a grave: À

You need to be generating:  <p>This is an A character with a grave: &agrave;</p>

You can optionally use the entity code, like: <p>This is an A character with a grave: &##224;</p>  (Note the double # to ensure ColdFusion does not assume you wanted a variable/BIF there.

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
New Here ,
Oct 02, 2013 Oct 02, 2013

Copy link to clipboard

Copied

I thought it was all UTF-8 as the response headers in Chrome said so. However, apparently ColdFusion was not processing as UTF-8 because the <cfprocessingdirective pageencoding="utf-8" /> tag did fix the issue. I had to place the tag in every page as it doesn't seem to work just in Application.cfc

There was a secondary issue that I didn't explain here. I store the translated text in .json files. So when <cffile /> was reading the translations it wasn't using UTF-8 either. Adding the charset="utf-8" quickly solved that issue as well.

Thanks for the help! I figured it would be something easy like that but didn't know where to start looking. This is our first translated app.

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
Enthusiast ,
Oct 02, 2013 Oct 02, 2013

Copy link to clipboard

Copied

LATEST

Very cool!  Glad I could help.  Internationalization, oh man, that's gonna be a fun challenge!

I think ColdFusion has tons of great Locale-based functions to help ensure that it caters itself to the consumer as best it can.

The <cfprocessingdirective> is usually used to encapsulate information that you want to modify whitespace or character encoding on, but are you using <cfcontent> without specifying the encoding anywhere?  Usually, CF outputs content encoded as UTF-8 (though it operates internally at UTF-16), but if a <cfcontent> is used at one point and doesn't specify the encoding, then CF is sometimes set to auto-determine the encoding.

I'm not sure if setting a header from the server-side down is an option, or, if you could utilize a meta tag to do likewise.

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