Ticket #471 (closed defect: fixed)
UnicodeEncodeException with sms
| Reported by: | arne.anka | Owned by: | daniel |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | framework/ogsmd/sms | Version: | milestone5.5 |
| Keywords: | Cc: |
Description
to test something i send myself a message with nothing but "test" in it from a sip account (sipgate.de). fr woke up (but did not suspend again, but that's another story) -- but the sms wasn't in the message book of zhone. restarting zhone resulted in messages not read at all ... checking the log shows:
2009.08.29 21:46:17.621 ogsmd.channel ERROR (ignoring) unhandled exception in response c allback: 'ascii' codec can't encode character u'\xf1' in position 7: ordinal not in range(128) Traceback (most recent call last):
File "/usr/lib/pymodules/python2.5/framework/subsystems/ogsmd/gsm/channel.py", line 422, in handleResponseToRequest
ok_cb( reqstring.strip(), response )
File "/usr/lib/pymodules/python2.5/framework/subsystems/ogsmd/modems/abstract/mediator.py", line 1035, in responseFromChannel
result.append( ( index, status, str(sms.addr), sms.ud, sms.properties ) )
UnicodeEncodeError?: 'ascii' codec can't encode character u'\xf1' in position 7: ordinal not in range(128)
little investigation turned up a page about unicode and stuff and based on that i changed /usr/lib/pymodules/python2.5/framework/subsystems/ogsmd/modems/abstract/mediator.py line 1035 from
result.append( ( index, status, str(sms.addr), sms.ud, sms.properties ) )
to
try:
result.append( ( index, status, str(sms.addr), sms.ud, sms.properties ) )
except UnicodeEncodeError?:
result.append( ( index, status, unicode(sms.addr), sms.ud, sms.properties ) )
which makes the messages show up again, including the last one -- but with the sender "sipgateñ". don't know, where that comes from (number is not in my contacts) and more so, where that n with circumflex comes from.
looks a bit like #362, but not the same.
Change History
comment:2 Changed 2 years ago by sim
decoration Changed 1 year ago by admin
bathtub Changed 1 year ago by admin
solar system Changed 1 year ago by admin
stair parts Changed 1 year ago by admin
solar supply Changed 1 year ago by admin

exception now wanders to "/usr/lib/pymodules/python2.5/framework/subsystems/ogsmd/modems/abstract/unsolicited.py", line 145, in plusCMT in plusCDS a few lines later the same thing seems possible (self._object.IncomingMessageReceipt?( str(sms.addr), sms.ud, sms.properties )) and in
/usr/lib/pymodules/python2.5/framework/subsystems/ogsmd/modems/abstract/mediator.py responseFromChannel at about line 1071 result = ( status, str(sms.addr), sms.ud, sms.properties )
at all these occurences i added a try/except UnicodeEncodeError? and replaced str() in the except with unicode()