Simon C
2006-04-01 16:24:10 UTC
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
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