How can I display the Trademark Symbol (™) on a UI Page?

afranklin
Mega Contributor

I've attempted to embed the Trademark symbol into a UI Page several ways, but so far they have all failed:

  • ™ results in an XML error (The entity "trade" was referenced, but not declared.)
  • ™ results in "™" being displayed
  • ™ results in nothing being displayed
  • ™ results in "™" being displayed
  • via various Jelly variables (results in similar results to examples above). ex.

<j2:set var="jvar_trade" value="&trade;"/>

<h1> Widget$[jvar_trade] </h1>

Any thoughts? Thanks!

1 ACCEPTED SOLUTION

Ravio - That works also!



BTW, It looks like the "&#0153;" code for trademark: (that I got from this page: http://www.tech-recipes.com/rx/143/copyright-and-trademark-symbols-in-html/) was never well-supported and that the unicode value "&#8482;" works as expected on ServiceNow



More details on this post: http://j.mp/1xL00DK


-------------------------


ISO-8859-1 reserves values 127-159 for control characters. These values are undefined and always have been for


- ASCII (which only goes to 127; there is no such thing as ASCII character 153, 169 or 174. ASCII is a seven-bit system so that programs can use the other bit to check for parity and so forth).


- ISO-8859-1 (which reserves these values for non-displaying control characters).


- Unicode (which overlaps with ISO-8858-1 for 0-255)


These values are defined for Windows-1252 and will cause you problems in almost any other character set and should never be used in HTML. You should use the Unicode value, that is &#8482; in decimal notation


-------------------------



To avoid any possible issues, I'll use the unicode code "&#8482;" on my pages.


View solution in original post

8 REPLIES 8

Jim Coyne
Kilo Patron

You are close.   You do need to use a Jelly variable, but use this instead:


<j2:set var="jvar_trade" value="&amp;trade;"/>


<h1> Widget$[jvar_trade] </h1>



You need to use "&amp;" instead of "&" because the "&" is a special character.


Thanks Jim,



I've tried that variation as well, but it also fails (it results in "&trade;" being displayed, just as if I hadn't used the Jelly variable at all). BTW, I'm testing this on Eureka if that makes a difference.




It seems that wrapping the encoding sequence in a Jelly variable works for ampersands, but fails for the trademark symbol (even when you encode its starting ampersand).




This is what finally worked for me:



<script>document.write(String.fromCharCode(parseInt(2122,16)));</script>




It's not pretty, but it works. If you come up with a better solution, please let me know.


Umm, another Eureka issue I guess, because it does work with Dublin.


Ravish Shetty
Tera Guru

Instead of "&trade;", try "${AMP}trade;"