Reply
Thread Tools Search this Thread
qwazix's Avatar
Community Council | Posts: 2,278 | Thanked: 4,144 times | Joined on Jan 2010
#1
The only thing that is missing now from the N900 so that it can be fully used as a phone in Greece is "reduced character support"
This is a mode that was used in older nokia phones (all symbian phones and dumbphones) and some other brands' phones in order to enable users to send messages in Greek without unicode support.

But let's start over and explain it a little better.
  1. The GSM alphabet consists of 127 characters, including (a) lower and uppercase latin letters, and (b) the capital greek letters that are not included in the latin alphabet
  2. Modern phones send messages in the 7bit GSM alphabet by default, but when they detect any other (unicode) char in the message, they convert it to unicode meaning that only 60 chars fit in one message
  3. Reduced character support was a mode that capitalized greek text and replaced all greek capital letters with their latin counterparts except ΓΔΘΛΞΠΦΨΩ just before the message was sent
  4. The guys over at myphone.gr made a ukeyboard layout for this but this is not very convenient as you either break contacts search, spell checking etc, or you have to have three layouts, which is inconvenient

Having those as facts I am thinking what can be done to resolve this issue and I have come down with some ideas. I want your feedback about those thoughts and any other idea may come to mind.
  1. Daemon to launch with a shortcut key that copies the text to clipboard, applies the transformation and pastes it back in the current box. Requires a way to emulate keystrokes (Ctrl+A, Ctrl+C, do stuff, Ctrl+V))
  2. A new keyboard layout for fastsms, but that leaves the vkb out
  3. Javascript in the rtcom-ui html but I tried showing an alert and it does not seem to work
  4. tampering with conversations so that it applies the transformation before sending (I don't even know if it is possible)
  5. Least desirable, terminal script that makes the transformation from user input so that I can copy-paste it manually in the message textbox
  6. Change layout each time I want to type one of ΓΔΘΛΞΠΦΨΩ. Out of the question.

HowTo:
  1. Install python and python-gtk2
  2. Install shortcutd
  3. Install xdotool (extras-devel usual warnings apply)
  4. copy the following code in a text file in /home/user/transform.py (encoded in utf-8 without bom) or download the attachment and rename it to transform.py
  5. make it executable (chmod +x transform.py)
  6. configure shortcutd to execute custom command ./home/user/transform.py on whatever event you like (i have it on longpress camera button)
  7. after you type a message longpress the camera button (or whatever you chose) and the text will be replaced by reduced character support
  8. Check the counter of sms chars remaining.

Known bug: sometimes you will see a sequence of letters beeing typed at the end of your message, if this happens press ctrl and keep it pressed until the text appears again transformed.

Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pygtk
import os
from string import maketrans
pygtk.require('2.0')
import gtk

def translate_uni(to_translate, translate_to=u'_'):
    not_letters_or_digits = u'!"#%\'()*+,-./:;<=>?@[\]^_`{|}~'
    if isinstance(to_translate, unicode):
        translate_table = dict((ord(char), unicode(translate_to))
                               for char in not_letters_or_digits)
    else:
        assert isinstance(to_translate, str)
        translate_table = string.maketrans(not_letters_or_digits,
                                           translate_to
                                              *len(not_letters_or_digits))
    return to_translate.translate(translate_table)


os.system("xdotool key ctrl+a")
os.system("xdotool key ctrl+c")
clipboard = gtk.clipboard_get()
text = clipboard.wait_for_text()

text = text.upper();
text = text.replace("α","A");
text = text.replace("ά","A");
text = text.replace("β","B");
text = text.replace("γ","Γ");
text = text.replace("δ","Δ");
text = text.replace("ε","E");
text = text.replace("έ","E");
text = text.replace("ζ","Z");
text = text.replace("η","H");
text = text.replace("ή","H");
text = text.replace("θ","Θ");
text = text.replace("ι","I");
text = text.replace("ί","I");
text = text.replace("ϊ","I");
text = text.replace("ΐ","I");
text = text.replace("κ","K");
text = text.replace("λ","Λ");
text = text.replace("μ","M");
text = text.replace("ν","N");
text = text.replace("ξ","Ξ");
text = text.replace("ο","O");
text = text.replace("ό","O");
text = text.replace("π","Π");
text = text.replace("ρ","P");
text = text.replace("σ","Σ");
text = text.replace("ς","Σ");
text = text.replace("τ","T");
text = text.replace("υ","Y");
text = text.replace("ύ","Y");
text = text.replace("φ","Φ");
text = text.replace("χ","X");
text = text.replace("ψ","Ψ");
text = text.replace("ω","Ω");
text = text.replace("ώ","Ω");

text = text.replace("Α","A");
text = text.replace("Β","B");
text = text.replace("Ε","E");
text = text.replace("Ζ","Z");
text = text.replace("Η","H");
text = text.replace("Ι","I");
text = text.replace("Κ","K");
text = text.replace("Μ","M");
text = text.replace("Ν","N");
text = text.replace("Ο","O");
text = text.replace("Ρ","P");
text = text.replace("Τ","T");
text = text.replace("Υ","Y");
text = text.replace("Χ","X");
#greek  = "ΒΕΖΗΙΚΜΝΟΡΤΥΧ".encode('ISO 8859-7')
#common = "ABEZHIKMNOPTYX".encode('ISO 8859-7')


#text = text.translate(transtab)

clipboard.set_text(text)
clipboard.store()
os.system("xdotool key ctrl+v")
EDIT: I found the bug. It's in xdotool and not my code. The problem occures only if you activate the script when greek keyboard layout is active. Two workarounds, the one mentioned above the code and the obvious, return to english before pressing the camera button.

Related thread http://groups.google.com/group/xdoto...d36fd1da9b7c14

EDIT2: Now you can find it in extras-devel. Hopefully it will ask to replace shortcutd configuration

EDIT3: Now it modifies the shortcutd configuration upon install and backs up the old. Still you have to restart shortcutd manually
Attached Files
File Type: txt transform.py.txt (2.5 KB, 71 views)

Last edited by qwazix; 08-16-2011 at 07:44 PM.
 

The Following 3 Users Say Thank You to qwazix For This Useful Post:
Posts: 120 | Thanked: 91 times | Joined on Sep 2010 @ Russia
#2
1. Daemon to launch with a shortcut key that copies the text to clipboard, applies the transformation and pastes it back in the current box. Requires a way to emulate keystrokes (Ctrl+A, Ctrl+C, do stuff, Ctrl+V))
Install keyboard-shortcuts. Also install CSSU, so as to get keyboard-shortcuts work.

Tune /apps/osso/hildon-desktop/key-actions/dbus_shortcuts_use_fn to press Ctrl-Fn-<letter> instead of Ctrl-Shift-<letter>.

Make script that applies the transformation of text:

Code:
#!/usr/bin/python
import pygtk
pygtk.require('2.0')
import gtk

clipboard = gtk.clipboard_get()
text = clipboard.wait_for_text()

# transform

clipboard.set_text(text)
clipboard.store()
Edit /usr/bin/keyboard-shortcuts:

Code:
     if key == 'c':
         os.system("su user -c 'run-standalone.sh /path/to/transform/script'")
Enter text, Ctrl-C, Ctrl-Fn-c, Ctrl-V
 

The Following User Says Thank You to ForeverYoung For This Useful Post:
qwazix's Avatar
Community Council | Posts: 2,278 | Thanked: 4,144 times | Joined on Jan 2010
#3
I found that xdotool is available for fremantle so I can send the keystrokes from a shell script. I am thinking using ctrl+fn+s to send transformed...
 
qwazix's Avatar
Community Council | Posts: 2,278 | Thanked: 4,144 times | Joined on Jan 2010
#4
I am getting a dependency problem with keyboard shortcuts (probably because I have portrait hildon desktop, and when I force it then it breaks apt-get)
grrr....

EDIT: ok I fixed the dependency problem with a modified deb, now I don't seem to get it working, I posted my problem over to the portrait-hildon-desktop thread. Going to try some more things and come back

Last edited by qwazix; 08-11-2011 at 08:25 AM.
 
qwazix's Avatar
Community Council | Posts: 2,278 | Thanked: 4,144 times | Joined on Jan 2010
#5
Tadaa! Greek sms 160 char support for our N900, albeit a bit buggy but maybe I manage to squish the bug.
 
Posts: 2,799 | Thanked: 4,437 times | Joined on Nov 2007
#6
Hm, couldn't this be expanded to cover more of the GSM 03.38 character set (which contains rather more non-ASCII characters than just Greek, eg accented latin letters, currency symbols etc)?
 
qwazix's Avatar
Community Council | Posts: 2,278 | Thanked: 4,144 times | Joined on Jan 2010
#7
I am not sure I understand what you mean. The idea is to replace chars with similar ones in the GSM alphabet so that it does not fall back to unicode. Are there other characters that have similar ones in the GSM alphabet? If yes post a table with them and I am happy to include them.

For example

ά ==> A
β ==> B
...
 

The Following User Says Thank You to qwazix For This Useful Post:
qwazix's Avatar
Community Council | Posts: 2,278 | Thanked: 4,144 times | Joined on Jan 2010
#8
Beta release. It's being built now for extras-devel (expect it in a few minutes, build 5), and sadly may never make it out of there as it uses xdotool which has a small bug and it also is in devel.

Anyway now it's just an install away
 
Posts: 2,799 | Thanked: 4,437 times | Joined on Nov 2007
#9
Originally Posted by qwazix View Post
I am not sure I understand what you mean. The idea is to replace chars with similar ones in the GSM alphabet so that it does not fall back to unicode.
Sorry, I misunderstood what it does and was talking nonsense :-(
 
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

 
Forum Jump


All times are GMT -4. The time now is 05:20 PM.