tags:

views:

220

answers:

2

I'm trying to auto-generate a plain text email with a trademark symbol in it. I've tried everything I can think of but it's still not going through.

<cfmail from="#x#" to="#y#" subject="test" charset="UTF-8">
  ™
  &trade;
  #Chr(153)#
</cfmail>
+2  A: 

I think that this is not so much an issue with CFMail but rather an issue with email clients displaying the characters codes in plain text messages literally rather than converting them to their corresponding characters.

Using CFMail in HTML mode should provide the result you're looking for.

Matty
+4  A: 

This is an encoding issue.

You state the mail is encoded as UTF-8, but Chr(153) does not return a trademark symbol in Unicode. It does in Windows-1252, but Chr() works with Unicode code points.

Use Chr(8482) to nail it to the Unicode TM symbol.

I've found an info page that outlines the issue nicely.

By the way, writing the literal TM symbol works for me as well. But this assumes your .cfm files are in fact encoded as Windows-1252 and that the ColdFusion runtime is configured to expect this (Both of which is the default on Windows systems, where I've tested it on. Analog rules apply to other systems.). ColdFusion converts all strings to Unicode internally, so maybe something is broken in this chain of expectations in your set-up.

Tomalak
Wonderful, thanks!
Joe Zack