Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

writing ascii character 153 in text widget

26 views
Skip to first unread message

Mona

unread,
Jan 5, 2010, 9:42:12 PM1/5/10
to
Hi,

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.

Arjen Markus

unread,
Jan 6, 2010, 3:00:56 AM1/6/10
to

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

Donal K. Fellows

unread,
Jan 6, 2010, 4:53:12 AM1/6/10
to

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.

Kevin Kenny

unread,
Jan 5, 2010, 9:54:07 PM1/5/10
to

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

unread,
Jan 6, 2010, 1:19:24 PM1/6/10
to
Thanks all! This worked.


Mona.

0 new messages