|
Fw: SyncBBDB patch for arbitrary encodings of bbdb and palm
|
Aaron Kaplan
|
Mar 16, 2008 15:02 PST
|
Kambiz Darabi, whose address I won't expose here without his
permission, writes:
| | Hello Aaron,
as there are no mailing lists and two empty forums on
sourceforge, I decided to contact you by PM. I hope
it's OK.
|
No problem, but please use pilo-@topica.com in the future. I should
update the SyncBBDB contact info to say that.
| | First of all many thanks for your work on SyncBBDB,
which I wanted to use for a long time. However, I
always had problems with character encodings and
each sync would mess up the umlaut characters in
the German names in my bbdb file.
Today I had some time and sat down to look at the
problem, although I've never programmed in Perl.
I have found a solution which works for me. It roughly
does the following:
- check whether the .bbdb file has a -*- coding: .... -*-
header line
- if yes, use that encoding to convert to/from .bbdb (if no
header line is present, use iso-8859-1)
- check the 'palm-coding' entry in the control file (initially
set to iso-8859-1) and use that encoding to convert to/from
Palm
With this patch, I can
(setq bbdb-file-coding-system 'utf-8)
edit .pilotmgr/SyncBBDB/control and set the 'palm-coding' to
the appropriate encoding for my Palm.
Sync happily with SyncBBDB without destroying all umlaut
characters.
The only question which I cannot solve as I don't have enough
background information:
- What's the use of the conversion of 0x80 - 0xff characters
to octal in bbdbRecord eStr? With which file encoding does this
give good results?
I have commented that part, as it wouldn't work with my solution.
If the patch is of any use to somebody else or if you would
like to integrate parts of it into the code base, please
feel free to do so. It has been created against a CVS
checkout from 2008-02-27.
Although I'm sure somebody with programming experience in Perl
will probably laugh out loud when seeing this code, but it
did solve my problem. :-)
Many thanks
Kambiz Darabi
|
Thanks very much for this. It's been on my todo list for years, but
never seemed to make it to the top of the list.
What you did to determine the encoding on the bbdb side looks right. On
the palm side, I think we should consult the environment
variable PILOT_CHARSET, which is already used by the latest versions of
libpisock, instead of using a SyncBBDB-specific setting. Also, if I
understand this discussion correctly
http://bugs.pilot-link.org/1565
it might ultimately not be necessary to do the conversion explicitly in
SyncBBDB, because we could get libpisock to handle it transparently for
all conduits.
Hopefully I'll find a moment eventually to check in a more general
solution, but in the meantime, here's the patch in case anyone else
wants to try it.
-Aaron
|
|
 |
|