I am trying to write the "trademark" symbol ("TM"(small and upper)
character in my text widget, but when I do this:
<text_widget> insert end [format "%c" 153];
it writes a bold line, something like a thin question mark sign.
How can I write the "trademark" symbol, character 153 in my text
widget?
Thanks,
Mona.
Probably a problem with character encodings or fonts. I have used the
UNICODE character (on Windows, running wish85) and got a nice
superscripted
TM:
<text_widget> insert end \u2122
did the trick.
Regards,
Arjen
That's only character 153 in some encodings (the Windows single-byte
ones as it happens). If we use this little script (in tkcon):
foreach e [lsort [encoding names]] {
puts "${e}: [encoding convertfrom $e [format %c 153]]"
}
Then we see that it's only for cp1250, cp1251, cp1252, cp1253, cp1254,
cp1255, cp1256, cp1257, and cp1258 that we get a ™ character for 153.
Internally, of course, Tcl's UNICODE (which means it can handle much
larger character sets, which is actually rather useful) so that symbol
is best done with \u2122 in scripts. (You were actually creating the
"Single Graphic Character Introducer" character, which isn't used in
UNICODE really and was marked as a bogus character, which is what that
bold line/question mark symbol was really about.)
Donal.
Character 153 is the 'trademark' symbol only in some Windows
code pages. Tcl uses Unicode internally. Try
.path.to.the.widget insert end \u2122; # Unicode 'Trade Mark Sign'
and see if that works any better.
--
73 de ke9tv/2, Kevin
Mona.