Phone encodings (revisited)

"Simon C" <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <001d01c655a8$b5997e80$0201a8c0@HOME>
Roger,

As a partial fix for the encoding problem can we do the following?
Add an encoding type attribute to the phone profile (default None), it is up
to the developer to specify the phone's encoding otherwise the default
(ascii) is used.
When send/get phone data is selected change the default encoding to what the
phone supports.
When send/get complete (or on exception) set encoding back to default(ascii)

This still leaves graceful failure to be implemented.

I did some tests on my phone and it worked retrieving and sending non-ascii
characters using iso-8859-1.

For changing the encoding I used: (in mainwindow)

    def __init__:
	  self.default_unicode_encoding=sys.getdefaultencoding()

    def BPSetUnicodeEncoding(self, encoding):
        if encoding==None:
            encoding=self.default_unicode_encoding
        print "setting encoding to "+`encoding`
        if sys.getdefaultencoding()!=encoding:
            # set locale for phone
            if not hasattr(sys, 'setdefaultencoding'):
                savedStdout = sys.stdout
                savedStderr = sys.stderr
                reload(sys)
                sys.stdout = savedStdout
                sys.stderr = savedStderr
            sys.setdefaultencoding(encoding)
        return


Simon





-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
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.