how to display unicode in a Label in Tkinter

Jeff Epler jepler at unpythonic.net
Thu Aug 19 04:16:23 CEST 2004


I have to warn you, my remarks below are based on an extensive knowledge
of tcl, and a tiny knowledge of arabic.

On Wed, Aug 18, 2004 at 02:50:07PM -0600, A K wrote:
> um i waswondering if the web page yu provided gave code that did the 
> following
> 
> 1) provide a function that reverses the order of the text

string:revert reverses the whole string, and turns "(" into ")" and vice
versa.  The first loop at the top of "proc uc:arabchar2glyph" unreverses 
strings of digits, possibly with embedded spaces, hyphens, dots, and
commas.

The next two blocks turn digits (optionally) and the punctuation
characters "?" and "," into equivalents ("ARABIC QUESTION MARK" and
"ARABIC THOUSANDS SEPARATOR").

The next two sections use commas (no "original" commas remain after an
earlier step, so this is safe) to deal with combining characters.  Here
things go beyond my little knowledge of arabic.  First, a comma is added
at the "side" of each glyph that is a combining glyph, then the
glyphs-with-commas are turned into the combined glyphs.  For instance,
the first two entries in that list are for turning the characters
    U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE
    U+0644 ARABIC LETTER LAM
into
    U+fef6 ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM
assuming the commas produced earlier are in the right place.

List (in arabchar2glyph), any remaining commas (from glyphs that didn't
combine) are removed, and the string is returned.

The final "proc ar:ligatures" does even more substitution.  The first
pair of items turns the sequence
    U+fea4 ARABIC LETTER HAH MEDIAL FORM
    U+fee4 ARABIC LETTER MEEM MEDIAL FORM
    U+fedf ARABIC LETTER LAM INITIAL FORM
into
    U+fd88 ARABIC LIGATURE LAM WITH MEEM WITH HAH INITIAL FORM

I think these two specific examples will seem "backwards" to you,
because at both steps the string has been "rendered" from logical order
to European left-to-right order.

> 2) stores the unicode number of the arabic characters in an array and 
> assigns them a letter or character from the keybord.

Yes, the portion of the code beginning "proc buckwalter2uc" turns an
ASCII representation of Arabic text into the proper unicode characters.

> 
> Also the attachment yu sent contained a bunch of non-sense. I was wondering 
> what it was supposed to be. thank you for your help.

The attachment is generated by software called "gpg", which is related to
older software called "PGP".  It is a "signature" that allows people who
read messages I write to be confident that I wrote them.  You could use
the gpg software yourself to verify the signature.  In my e-mail program,
something this is displayed at the
top of a signed message:
  [-- PGP output follows (current time: Wed 18 Aug 2004 08:38:54 PM CDT) --]
  gpg: Signature made Tue 17 Aug 2004 09:06:45 PM CDT using DSA key ID 96935D7D
  gpg: Good signature from "Jeff Epler <jepler at unpythonic.net>"
  [-- End of PGP output --]
gpg can also be used to encrypt the contents of e-mail messages, giving
some measure of privacy to online conversations.  You can learn more
about gpg by visiting www.gnupg.org if you're interested, though that
website seems to be geared to people who already know what gpg is and
why they want it..

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20040818/b4b6f599/attachment.sig>


More information about the Python-list mailing list