June 20, 2008
· Filed under Python, Technology

These days I’ve been working with SMS messages. Due to the fact that I work in a Greek company, the character set of these messages should be Greek (or able to contain greek letters). As far as I know there are 3 options to accomplish this:
- Use unicode (UCS2, it’s like UTF-16). But you’ll get only 70 characters per SMS.
- Use GSM 03.38 encoding. You get 160 characters per SMS, but a reduced set of characters.
- 8 bit encoding. I wasn’t able to figure how this work with the Greek charset (yet).
So for our new SMS delivery system we decided to go with the almost universal GSM 03.38 encoding. Also we changed our hacked java
SMPP client to
pythomnic and it’s SMPP library.
That works great but the library doesn’t know anything about encoding. Using iso-8859-1 works, but for Greek we need some kind of “automatic conversion”. This was done using a python encoding module (for python 2.4).
From Greek to GSM 03.38 you have to understand that gsm supports only a few greek letters, they’re in uppercase and without tones. Therefore:
- All lowercase greek letters are transformed to uppercase.
- Tones and diaeresises are removed.
- For some upper case letters, latin ones are used instead. Example: rho: ρΡ -> P (Even in a web browser is difficult to see the subtle difference).
Example:
>>> import gsm0338
>>> msg = u”Αναταράξεις στο πολιτικό σκηνικό προκαλεί η υπόθεση Siemens”
>>> msg.encode(”gsm0338″)
‘ANATAPA\x1aEI\x18 \x18TO \x16O\x14ITIKO \x18KHNIKO \x16POKA\x14EI H Y\x16O\x19E\x18H Siemens’
ANATAPAEI TO OITIKO KHNIKO POKAEI H YOEH Siemens
>>> print msg.encode(”gsm0338″).decode(”gsm0338″)
ΑΝΑΤΑΡΑΞΕΙΣ ΣΤΟ ΠΟΛΙΤΙΚΟ ΣΚΗΝΙΚΟ ΠΡΟΚΑΛΕΙ Η YΠΟΘΕΣΗ Siemens
If what you see is useful for you, here is the gsm0338.py encoding module for python 2.4.
Tags:encoding, gsm 03.38, python, python 2.4 »
June 8, 2008
· Filed under Friends, Greece, Personal, Places

After long Friday and Saturday finishing some java and xhtml jobs, Sunday was the perfect day to take things easy and spend the day with friends. We (Sascha and me) decided to go to Markopoulo, Panos base camp, and try to relax.
Panos was repairing his iBook. The harddrive of that beautiful piece of technology broke, and he got a new one. But disassembling a laptop is not easy: lots of screws around, manuals, drafts and of course the uncertainty of “will it work? or I’ll break it?”. So that was the reason we decided to give him some company and support.
But panos is very capable of doing that job. What will we do meanwhile? Well, I wanted to learn about Zope, and he works with Zope: perfect combination (no, not a “secret combination“). So Sascha prepared a tutorial on how to install Zope, and some examples. Also he introduced me to Darcs (code management system), and we were playing a bit with that and the local area.
Also I introduced him to Git (another code management system). But I’m not so expert on git, and also Git installation on Mac OS requieres patience and be able to stand MacPorts installing everything on your system (even if you had it). Anyway, you should check this video about Git with Linus Torvalds talking in Google. It’s about git, but it can be about any distributed source control system.
We did a stop for lunch, and perhaps because the planet was bored (it happens from time to time), an earthquake happened. I didn’t feel it, perhaps the two pizzas we ordered left me a bit numb (I fixed that with a fresh frape).
After the iBook surgery was complete, we went to the nearest beach (Markopoulo has no sea, but it’s near) on “Porto Rafti” for a quick and fresh swim. The water was a bit cold, but at 6 in the afternoon, there was no one there
We were talking about how would be life doing the same job we do, but doing it in a small island in the Aegean sea. A VPN to the main office, no traffic jams, living near the beach, good food and cheap coffees.
Nice things to note from today.
- Zope seems a powerful web application server for python. I have to give it some time.
- Darcs also seems good. I’ll continue my experiments with Git, but now I know that I can work with Sascha really easily using Darcs.
- MacPorts behaves in a silly way when he wants to install software that it’s in your system. (The next step is to compile the Darwin kernel in order to install bash).
- I do not feel earthquakes when I’m sleepy.
- Love to have a swim late in the afternoon.
Now we continue slacking off while Panos installs Tiger in his iBook. I guess it’s time to return I still have to clean the dishes from yesterday and prepare dinner
(Well, breaking news, we will have dinner here). Tomorrow more boring office job not doing much, just a bit here and there and waiting for the typical “We have to fix this for today” at 5:30 in the afternoon.
Tags:Darcs, Git, markopoulo, Panos, python, Sascha, Sea, Zope »