Can Python fix vcard files?

Paul Boddie paul at boddie.org.uk
Tue Oct 14 07:06:49 EDT 2008


On 14 Okt, 02:31, "Dotan Cohen" <dotanco... at gmail.com> wrote:
> KDE's Kontact PIM breaks quoted-printable vcard files because it
> linebreaks in the middle of a word. Take this text for example:
> NOTE;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=D7=A9=D7=95=D7=A8=D7=94 =D7=A
>  8=D7=90=D7=A9=D7=95=D7=A0=D7=94.\n=D7=94=D7=A9=D7=95=D7=A8=D7=94 =D7=94=D7=
>  A9=D7=A0=D7=99=D7=94 =D7=9B=D7=\n
>
> The whole thing should be on one line, and the spaces at the beginning
> of each line shouldn't be there at all. I have a directory with 422
> files corrupted like this.

Although I think it's "rude" to break quoted-printable characters in
the middle (as seen above), isn't it permitted by the specification to
wrap lines to a predetermined length? It's been a while since I looked
at the specification, but this is one of the things that
implementations have to be able to handle.

> Can Python go through a directory of files and replace each instance
> of "newline-space" with nothing? The system is Ubuntu 8.04 with KDE if
> it matters. Thanks.

You should file a bug against Kontact: the KDE developers love fixing
bugs, especially in their old work. ;-)

Paul



More information about the Python-list mailing list