Re: Non Unicode chars in SMS text

Yosef Meller <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
[email protected] wrote:
> Ran into this when I was testing the SMS code: some ISP insert cutesy non-unicode characters into their ads which are appended to outgoing mail messages, some of which are SMS messages.  As a result, BitPim raised an exception while trying to save these messages.  Any suggestions as how to handle this?
> 
> Thanks,
> 
> -Joe Pham

I had a similar problem with reading phonebook entries in Hebrew. I 
followed the discussion here and did the translation in the code that 
reads the phonebook (under the assumption that a phone that uses 
different encoding than what I hard-coded in would have a different module).

See com_sk6100.py for the code details.
> 
> 
> 
> An unexpected exception has occurred.
> Please see the help for details on what to do.
> 
> Traceback (most recent call last):
>   File "f:\My Documents\cell_apps\bitpim\gui.py", line 1256, in OnCallback
>     event()
>   File "f:\My Documents\cell_apps\bitpim\gui.py", line 122, in __call__
>     return apply(self.cb, self.args, self.kwargs)
>   File "f:\My Documents\cell_apps\bitpim\gui.py", line 79, in __call__
>     apply(self.method, self.args+args, d)
>   File "f:\My Documents\cell_apps\bitpim\gui.py", line 942, in OnDataGetPhoneResults
>     self.smswidget.populatefs(results)
>   File "f:\My Documents\cell_apps\bitpim\sms_tab.py", line 253, in populatefs
>     self.__save_to_db(dict.get(self.__data_key, {}))
>   File "f:\My Documents\cell_apps\bitpim\sms_tab.py", line 250, in __save_to_db
>     self.__main_window.database.savemajordict(self.__data_key, db_rr)
>   File "F:\My Documents\cell_apps\bitpim\database.py", line 263, in _transactionwrapper
>     return method(*args, **kwargs)
>   File "F:\My Documents\cell_apps\bitpim\database.py", line 507, in savemajordict
>     self.sql(" ".join(cmd), [timestamp]+[record[r] for r in rk])
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xa1 in position 152: ordinal not in range(128)

-- 
    "No, I do not contain myself,"
   were the final words from the set of self-excluding sets. :-)


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.