Failure reading vCards due to encoded PHOTO

Pat Double <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
I'm using BitPim 0.90.3. I am trying to import vCards. One of my entries has a 
PHOTO in it. I get an exception that utf8 cannot read "0xff". If I remove the 
photo it reads the whole file just fine. I believe it is decoding the binary 
and then trying to read it as text, although it is marked as binary data. I 
am willing to share the entire file via private email if need be.

=== Exception:

BitPim version: 0.9.03-Gentoo
An unexpected exception has occurred.
Please see the help for details on what to do.

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", 
line 13535, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "//usr/lib/bitpim-0.9.03/guihelper.py", line 155, in _busywrapper
    return method(*args, **kwargs)
  File "//usr/lib/bitpim-0.9.03/importexport.py", line 642, in UpdateData
    self.FillPreview()
  File "//usr/lib/bitpim-0.9.03/importexport.py", line 682, in FillPreview
    self.preview.SetCellValue(row+1, col, s)
  File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/grid.py", line 
1971, in SetCellValue
    return _grid.Grid_SetCellValue(*args, **kwargs)
  File "/usr/lib/python2.4/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0: 
unexpected code byte

Variables by last 8 frames, innermost last

Frame OnFileImportVCards in //usr/lib/bitpim-0.9.03/importexport.py at line 
1762
           path =  u'/home/double/test.vcf'
            dlg =  <importexport.ImportVCardDialog; proxy of C++ wxDialog 
instance at _2801c008_p_w
           data =  None
         parent =  <gui.MainWindow; proxy of C++ wxFrame instance at 
_08c15708_p_wxFrame>

Frame ShowModal 
in /usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_windows.py at 
line 680
           args =  (<importexport.ImportVCardDialog; proxy of C++ wxDialog 
instance at _2801c008_p_
         kwargs =  Keys []
                   {}

Frame <lambda> 
in /usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core.py at line 
13535
          event =  <wx._core.PyEvent; proxy of C++ wxPyEvent instance at 
_6842c108_p_wxPyEvent>

Frame _busywrapper in //usr/lib/bitpim-0.9.03/guihelper.py at line 157
           args =  (<importexport.ImportVCardDialog; proxy of C++ wxDialog 
instance at _2801c008_p_
         method =  <function UpdateData at 0xb6905f7c>
         kwargs =  Keys []
                   {}

Frame UpdateData in //usr/lib/bitpim-0.9.03/importexport.py at line 642
           self =  <importexport.ImportVCardDialog; proxy of C++ wxDialog 
instance at _2801c008_p_w

Frame FillPreview in //usr/lib/bitpim-0.9.03/importexport.py at line 682
           attr =  <wx.grid.GridCellAttr; proxy of C++ wxGridCellAttr instance 
at _00f7bd08_p_wxGri
        oddattr =  <wx.grid.GridCellAttr; proxy of C++ wxGridCellAttr instance 
at _f8a7bd08_p_wxGri
           self =  <importexport.ImportVCardDialog; proxy of C++ wxDialog 
instance at _2801c008_p_w
       evenattr =  <wx.grid.GridCellAttr; proxy of C++ wxGridCellAttr instance 
at _480fbe08_p_wxGri
        numrows =  133
              s 
=  '\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x02\x00\x00\x00\x00\x00\x00\xff\xdb\x0
         editor =  <wx.grid.GridCellChoiceEditor; proxy of C++ 
wxGridCellChoiceEditor instance at _
            col =  20
        numcols =  22
            row =  28

Frame SetCellValue 
in /usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/grid.py at line 
1971
           args =  (<importexport.PreviewGrid; proxy of C++ wxGrid instance at 
_f0afc008_p_wxGrid>,
         kwargs =  Keys []
                   {}

Frame decode in /usr/lib/python2.4/encodings/utf_8.py at line 16
          input =  <read-only buffer ptr 0x8be7994, size 8348 at 0xb518c400>
         errors =  'strict'


=== Data snippet:

BEGIN:VCARD
ADR;TYPE=work:;;(removed);(removed);(removed);(removed);USA
ADR;TYPE=home;TYPE=pref:;;(removed);(removed);(removed);(removed);United St
 ates of America
BDAY:1975-11-16T00:00:00Z
CATEGORIES:Business\,FBC\,Personal
CLASS:PUBLIC
EMAIL;TYPE=PREF:[email protected]
EMAIL:[email protected]
FN:Pat Double
N:Double;Pat;;Mr.;
NICKNAME:Pat
ORG:Interactive Information R&D
PHOTO;ENCODING=b;TYPE=image/jpeg:/9j/4AAQSkZJRgABAQIAAAAAAAD/2wBDAAEBAQEBAQ
 EBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA
 QH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
 AQEBAQEBAQEBAQEBAQH/wAARCACMAGQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAE
 CAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0
 KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc
 3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW
 19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQo
 L/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYn
 LRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g
 oOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk
 5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD4w03TbHyuYQfX/PA9P1r0/QNMh/4+P8+nr+P
 Feb6BN50VuM9vr7f5Ga9Q02aDkH3H9Oce5xz9OOCfy8+k+reX9f8AgR7R4b02x/0f/Qba54J/0u
 z7/wA/xxzyOor6A0Gzg4/0G2GOc2ln3H9ffNeD+HJf+PfyPxH+f0B+nrWh4w+PPgf4b2FxNfX39
 pax0s/Dtp/gf5fnXQdP1Zd1+P8AmfXE3iTw54P0v7dquq22m29re6Xe/wCl8d//AK2cj5T+JrQ8
 OftjaV/ankaHBnR7W9+w/wBrDP8AaY9/7DOM/wAu3sPwf+JHx+8VfEfX/t08+bf/AJc7O0/w9vq
 eevejwr4wng/fzj1/X6545zwB69TmuieG5ouLbtJPV+ez29L6727FRwtpRkrOSkmr83deu+n3+Z
 /Wf8Mf2tPhzDdW1vrs9zqQuv8Ajz/ta81k++cY68ew+pxX2D4P+Nnwy8Y3Rt/B2uW1xc/8vtof+
 Jb/AMTQD+ZwPfPev5D/AAr8Tr68it4IL66tvs3/AC99unXrz9O/5V9IfDf42a54Ju/Pgnubb7Ve
 enOoD/oNe/69CODzXydfK6lHmnRr6J80U3e+sHbdWvu1+J7uFoUsTaOJhK65ErLp7t9V6rt6bo/
 qQ1jxhPpsXneecep/L/P06YNcPefFSeH/AJbm29z+HPX8P5+/53/CT9ou48ef2PpOq659p+y/8e



-- 
Pat Double, [email protected]
"In the beginning God created the heaven and the earth."

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&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.