views:

1235

answers:

3

We need to send email which contains Pound (currency) symbols in ColdFusion. Before sending email, we are dumping the data into a html file for preview.

  1. How to send a email with utf-8 encoding in ColdFusion
  2. How to save a file with utf-8 encoding in ColdFusion
A: 

Try adding <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> in the <head> tag of your html file.

Alterlife
+7  A: 

E-Mails are sent in the encoding that is specified in the ColdFusion Administrator. For ColdFusion MX (6.0) and up this is UTF-8 by default.

You can explicitly mention the encoding like this, but it should not be necessary.

<cfmail type="text/html; Charset=UTF-8" ...><!--- body ---></cfmail>

For the HTML file you dump to disk, the following applies:

<cffile action="write" charset="UTF-8" ...>

And you should have the encoding as a META tag, so the browser you use for preview does not have to guess:

<meta http-equiv="Content-Type" content="text/html; Charset=UTF-8">
Tomalak
A: 

In addition to marking the mail as UTF-8, you may need to direct ColdFusion that your template being run should be unicode aware as well. Stick this tag right at the top of your template. If you don't you might end up with garbage in the email anyway.

<cfprocessingdirective pageencoding="UTF-8">

There is some fairly good information available from Adobe on the subject here:

http://www.adobe.com/support/coldfusion/internationalization/internationalization_cfmx/internationalization_cfmx3.html

Goyuix