RE: Problem with UNICODE filenames still not fixed :(

"Simon C" <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <001701c5c7d4$5df07100$6400a8c0@HOME>
> The best fix is for someone to provide a patch.  We use
> Unicode for the wxPython side of things.  Python is dual
> mode being in Unicode mode if you give unicode strings
> else text mode.
> 
> The function SHGetFolderPath is supposed to return a
> unicode string if appropriate according to the doc.
> 
> This should only be a line or two of code to fix.  But it
> requires someone with an affected system to work on.

I am able to reproduce by using a path with non-ascii characters.

There are three problems that prevent bitpim from running from the command
line.
1) com_brew.py. line 935.
            print 'setting path to',bitpim_path
needs to be deleted or made unicode safe as print does not work with unicode
strings. A quick hack is to change it to 
            print 'setting path to',`bitpim_path`
This results in the unicode part of the string being printed as raw hex in
the console output.


2) A bug in sqlite3 (bug #1206) that prevents the database from being
opened. It is fixed in 3.2.7. I downloaded the new version of aspw
(3.2.7-r1) which I assume uses this new sqlite version and this fixed the
problem.


3) In guiwidgets.py, the line:
                if not os.access(item.filename, os.F_OK):
and in common.py (207)
     execfile(filename, dict, dict)
both fail with:

An unexpected exception has occurred.
Please see the help for details on what to do.

Traceback (most recent call last):
  File "C:\Python23\Lib\site-packages\wx-2.6-msw-unicode\wx\_core.py", line
13266, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "C:\projects\bitpim\gui.py", line 1299, in
OnPopulateEverythingFromDisk
    self.wallpaperwidget.getfromfs(results)
  File "C:\projects\bitpim\wallpaper.py", line 448, in getfromfs
    return self.genericgetfromfs(result, None, 'wallpaper-index',
self.CURRENTFILEVERSION)
  File "C:\projects\bitpim\guiwidgets.py", line 1345, in genericgetfromfs
    common.readversionedindexfile(os.path.join(self.thedir, file), d,
self.versionupgrade, currentversion)
  File "C:\projects\bitpim\common.py", line 207, in readversionedindexfile
    execfile(filename, dict, dict)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 54-61:
ordinal not in range(128)

I tried filename.encode(sys.getfilesystemencoding()) but this inserted '?'s
in the string which did not work.
All I can think of to fix this is to avoid using these functions by finding
an alternative which is not too hard.
Joe, I can work on a fix if you want some help.

Simon



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
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.