pmarti / python-messaging

Pure python SMS/MMS encoder/decoder
Other
224 stars 114 forks source link

Add tests for 7bit latin-1 encoding #2

Open pmarti opened 14 years ago

pmarti commented 14 years ago

This area was slightly broken until recently due to our lack of unittests in this area. Having some unittests that explicitly target 7bit decoding (and not the rest of the PDU toolchain) would be very nice.

pmarti commented 14 years ago

Just added some tests in fed5ed100fdc8353b3442dd54b2aca5627be0444

This has helped to find an incorrect translation (ñ) in gsm0338.py, I need to add more tests or pimp up the existing ones to make sure the rest of the gsm0338 characters are OK.

andrewbird commented 12 years ago

I'm not sure if you meant Unicode <-> GSM 0338 encoding tests, I just added those and uncovered a couple of little bugs. There's still one thing I can't quite get my head around, are we supposed to be able to encode and decode 0x0000? For now I excluded it from the test, but if so we should fix the code and enable it in the test.

pmarti commented 12 years ago

Not really sure about 0x0000... I guess that for quality-wise would be good to handle it. Please do apply your patches

andrewbird commented 12 years ago

I pushed the three remaining patches. I held fire on the 0x0000 mapping, at the moment it would be asymmetric so could only go in the encode method with 'replace', but I think there is a special sequence of events that might allow it to be decoded too. It's something like if '\x40' appears when it's followed by valid character it becomes '@' if it's followed by '\x00' it's 0x0000.