Tutorial :What is the equivalent of chr(153) (The TM SYMBOL) in Unicode


In earlier Delphi versions, I could use


to get a trademark symbol in a string. In Delphi 2010, that doesn't work any longer, perhaps to do with unicode. What is the equivalent code string to put the TM symbol into my string?


I'm pretty sure that chr(153) is "Ö" (Code page 437), oh wait, it is "r" (EBCDIC 037).

Actually chr(153) is undefined unless you also specify the code page you are using.
Which is exactly the reason you should use Unicode.

Wikipedia has pages for most Unicode symbols, and includes the Unicode codepoint for them.

There is the plain trademark symbol having unicode codepoint U+2122 (Delphi: Chr($2122) or #$2122).
There is also the registered trademark symbol having unicode codepoint U+00AE (Delphi: Chr($00AE) or #$00AE).

The unicode site has a list of charts where you can find all symbols, but it takes time getting used how to find them (as the number of charts is a bit large).
The plain trademark symbol is part of the letterlike symbols.
The registered trademark symbol is part of the latin-1 supplement.



In D2010, I can do this:

s := 'â„¢' + chr(8482) + #8482;  // yields 3 subsequent TM symbols  

Result: ™™™

Here's a good article, by Joel himself - I re-read it just today, in fact.


As per the Unicode code chart for "letterlike symbols", the TM symbol is Unicode U+2122. I don't know enough Delphi to know how you turn that into a character - perhaps

s := chr(8482);  

? (8482 is the decimal for hex 2122.)

Alternatively, having looked at this page, you might try:

s := #$2122;  


It's character U+2122 (http://www.fileformat.info/info/unicode/char/2122/index.htm). I haven't used Delphi for a long time, but before anything else you should try to enter the character directly (probably using a Character Map utility like Windows's charmap.exe or BabelMap). That's easier to read than anything else.


To discover the Unicode codepoint for a given character, open Accessories -> System Tools -> Character Map, select a Unicode font, look for the character you need, in the lower left corner the application displays the Unicode code.


in html its &#x2122 try using it on http://code.cside.com/3rdpage/us/unicode/converter.html

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »