Krish
Krish

Reputation: 1153

How to save file as UTF-8 format

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

Upvotes: 4

Views: 3465

Answers (3)

Goyuix
Goyuix

Reputation: 24340

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

Upvotes: 0

Tomalak
Tomalak

Reputation: 338228

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">

Upvotes: 7

Alterlife
Alterlife

Reputation: 6625

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

Upvotes: 0

Related Questions