I'd like to make all registration symbols superscript by wrapping them with a <sup>
HTML tag. So, I can do this in SQL no problem:
SELECT s.id,
Replace(s.name,'®','<sup>®</sup>') AS name
FROM staff s
WHERE name LIKE '%®%'
Result:
id | name
1 | Name1 CFP<sup>®</sup>, CDFA
2 | Jeffrey test CFP<sup>®</sup>
3 | Matthew hello CFP<sup>®</sup> CFA
But when I run it in Coldfusion from a cfquery
tag, it looks as if the ®
character is interpreted as ®
.
<cfquery name="getStaff" dataSource="#this.dsn#">
SELECT s.id,
Replace(s.name,'®','<sup>®</sup>') AS name
FROM staff s
WHERE 1=1
<cfif isDefined("arguments.permalink")>
AND s.permalink=<cfqueryparam value="#arguments.permalink#" />
</cfif>
</cfquery>
Is there a better way to approach this? I originally did this in Coldfusion using <cfset getStaff.name = Replace(getStaff.name,Chr(174),'<sup>®</sup>') />
, which worked fine until I switched to Mustache templating.
I'd definitely prefer to use the CHAR()
function if I could figure out what numeric character ®
is in Mysql. (Note, using utf8_general_ci
on this and all DB tables) I tried CHAR(174)
in Mysql, but it won't work because (as far as I can tell) Mysql isn't using the same character set - SELECT CHAR(174)
returns a blob.