Comments (4)
Hi there,
Do you have some example Greek text in UTF8 I could test with?
Andrew
from python-messaging.
Hello and thank u for your response,
I have this code:
#!/usr/bin/env python
-- coding: utf-8 --
import messaging
from messaging import sms
from messaging.sms import SmsSubmit
sms = SmsSubmit('+3069000000', 'ΤΡΑΠΕΖΑ')
pdu = sms.to_pdu()[0]
print pdu.pdu
exit()
which successfully creates PDU but unreadable.
the greek text is "ΤΡΑΠΕΖΑ" and on http://rednaxela.net/pdu.php produce this "ÔÑÁÐÅÆÁ " same on mobile also.
Thank u!
from python-messaging.
Hi,
Okay I see what's happening. The GSM0338 character set doesn't include TAU, RHO, ALPHA, EPSILON, or ZETA, so when SmsSubmit is presented with a UTF-8 string containing any of those characters, the conversion to GSM characters cannot proceed. The fallback for this case, and actually is most common in non latin languages is to transmit the message in UCS-2 format. the downside of this is that the UCS-2 characters are 16 bit wide, not 7bits like GSM, hence the encoded text is much longer and may span multiple SMS. So both the decoder tool and the phone you are looking at the message on probably don't support UCS-2 messages. I expect that if you view the text message on a phone with a good GSM implementation like an Ericsson, you'll see the message you expect.
Looking at the gsm0338 wiki page there have been some additional shift pages added to allow for non-latin1 languages, but unfortunately not for Greek. If you know of some standard way of encoding the Greek characters that will be interpreted correctly, let me know, send me some sample text and encoded PDUs from a device that supports it and I'll look at adding it to SmsSubmit.
There is a facility to relax the text conversion and do character replacements for humans, e.g. TAU gets converted into latin 'T', which is probably acceptable although any unmapped chars end up as '?'.
Here's an example:
# -- coding: utf-8 --
from messaging.sms import gsm0338
print u'ΤΡΑΠΕΖΑ'.encode('gsm0338', 'replace').decode('gsm0338')
ajb@polly:~$ python test656664.py
TPAΠEZA
As you can see, it would probably suffice, as least for this example. Unfortunately as far as I can see there's no current way of asking SmsSubmit to relax the encoding. Certainly it will have to be an option as I want to maintain the current behaviour of falling back to UCS-2 if the conversion to GSM0338 is not exact.
from python-messaging.
Thank u very much , that i was looking for ! It works!!!
Thank u!
from python-messaging.
Related Issues (20)
- decode multipart pdu message HOT 1
- Concatenating multi-part PDU HOT 3
- How send MMS from Modem Dongle USB?
- How get a MMS message? HOT 3
- sms.cnt and sms.seq HOT 4
- Multipart SMS with Huawei e220 HOT 3
- MMSEncoder has no attribute 'encode_boolean_value'
- installation instructions HOT 2
- utf-8' codec can't decode byte 0xff in position 0 HOT 1
- Solution to problems with Polish characters
- Issue in timestap HOT 1
- message with smiles HOT 6
- python-messaging Failed to handle HTTP request HOT 1
- sms.class = 0 invalid syntax
- MMSEncoder has no no Expiry Encoder HOT 2
- Cannot specify multiple recipients
- decode send .mms headers From Date error
- TypeError: super() argument 1 must be type, not classobj HOT 1
- How can to encode an MMS without smil and just img/txt dataparts?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-messaging.