[Tutor] How to make foreign characters
Fri, 3 Aug 2001 15:15:24 -0400
On Fri, Aug 03, 2001 at 12:05:30PM -0700, Sheila King wrote:
| Hello, I need some advice and pointers:
| I've been teaching my 15 year old son his first programming language. (A
| good summertime project while off from school) Of course, Python.
| Anyhow, the project we are working on right now, is a french/english
| vocabulary quiz, that asks you random words (either french or english)
| and then you supply the translation. (I hope we will get some use out of
| this in the coming school year.)
| And now the question:
| How does one make the foreign characters in French (and other foreign
| languages). Like the accent symbols, or the "c" with the funny doo-hicky
| on the bottom? I figure it has something to do with Unicode, but I
| looked at the Unicode module documentation, and still didn't understand
| how I could get started typing symbols like that.
You need either Unicode or the proper charsets. Some "ASCII" charsets
(such as iso8859) use the characters above 127 for special symbols and
letters with accents. If you find all the characters you need in one
of those charsets then you can use that as long as you set the display
properly. For example I use 'less' as the pager for my emails. I had
to set the environment variable "LESSCHARSET" to "iso8859" in order
for those characters to be displayed properly. As for inserting them,
it is up to your editor how that works (I haven't looked into that yet
since I don't need it yet).
Unicode is just another way to convert the integers in memory to
glyphs on a screen. I haven't used it but it is supposed to be able
to represent (nearly) all the characters in all the alphabets
simultaneously (something that ASCII charsets can't do).
| I want it to be fairly easy to display and to type the special
| characters in this quiz game.
That would be nice.
I suppose you could have all input treated as a Python expression and
enter the Unicode literals the same way you would in a program. (or
add the u"" around the input programmatically) Then eval() the
expression to get the unicode string out of it.
Sorry I don't have a real solution.