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

CFMAIL character set not working

New Here ,
May 07, 2006 May 07, 2006

Copy link to clipboard

Copied

Hi everyone,

Recently we moved our websites to CF7 and we got a lot of problems with the character sets. We support multiple languages and we started to get a lot of issues related to the german, french or any other "special" characters like ä, ü, ß or any other.
Browsing the internet I learned how to fix most of them, including "<cfprocessingdirective pageencoding="ISO-8859-1">" into all our pages but we still have one problem that I cannot fix.

Our database backend it's a mySQL 4.1.12 with "UTF-8 unicode" default character set for all the tables.

If I do a query, for instance:

<cfquery name="get" datasource="dns">
SELECT *
FROM cart
WHERE customer = 12870
</cfquery>

And then I have the following code:

<cfoutput query="get">
#deliverystreet#
</cfoutput>

<cfmail to="xxx@xxx.com" from="xxx@xxx.comm" subject="test character set" server="localhost" type="HTML" charset="ISO-8859-1">
#get.deliverystreet#
Pietiläntie 30
</cfmail>

This is what I get on the screen:

Pietiläntie 30
Pietiläntie 30

But this is what I get into the email message:

Pietil?ntie 30
Pietiläntie 30

So, in other words, works fine on the screen, but it doesn't work with CFMAIL or CFFILE no matter what CHARSET I specify for these tags. But as you can see, if I just type in the text "Pietiläntie 30" between the mail tags, the text goes fine. But If it is a variable output #var# it doesn't. I have into Application.cfm also the following code:

<cfcontent type="text/html; charset=ISO-8859-1">
<cfset setEncoding("url", "ISO-8859-1")>
<cfset setEncoding("form", "ISO-8859-1")>

I think I already tried everything with no luck to make this work! I really need help, it's been a while since I am trying to fix this and it is very very important for me. Thank you!
TOPICS
Advanced techniques

Views

1.1K

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 ,
May 07, 2006 May 07, 2006

Copy link to clipboard

Copied

MacLaeod wrote:
> Our database backend it's a mySQL 4.1.12 with "UTF-8 unicode" default
> character set for all the tables.

you seem to be mixing encodings. try utf-8 instead of iso-8859-1. also
what db driver are you using?

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 ,
May 07, 2006 May 07, 2006

Copy link to clipboard

Copied

Hallelujah!!!

I think there are 4 or 5 month since I am facing this issue and only today I found the complete solution! In order to make CFMAIL and CFFILE tags to work fine with database results. In order to make it work, all you have to do is to open the DSN connection in the Cold Fusion Administrator, click on Advanced Settings and enter the following text to the CONNECTION STRING:

useUnicode=true&characterEncoding=iso-8859-1

A complete set of instructions to fix character sets issues here: http://www.xtreme-host.com/faq/index.php?qid=81&catid=9

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
Community Expert ,
May 07, 2006 May 07, 2006

Copy link to clipboard

Copied

I think you will avoid the problem in the first place if you leave the encoding at Coldfusion's default, UTF-8.

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 ,
May 07, 2006 May 07, 2006

Copy link to clipboard

Copied

LATEST
Are you talking about not using processing directive?
If so, it wouldn't work. If you don't use it, you don't have the good charset on the screen... if you use it, you don't have database results sent by email or saved to file...

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