python-messaging icon indicating copy to clipboard operation
python-messaging copied to clipboard

Add tests for 7bit latin-1 encoding

Open pmarti opened this issue 15 years ago • 4 comments

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 avatar Jun 09 '10 14:06 pmarti

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.

pmarti avatar Jun 10 '10 07:06 pmarti

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.

andrewbird avatar Dec 10 '11 15:12 andrewbird

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

pmarti avatar Dec 18 '11 09:12 pmarti

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.

andrewbird avatar Dec 18 '11 11:12 andrewbird