Can Python fix vcard files?

Paul Boddie paul at boddie.org.uk
Tue Oct 14 10:45:57 EDT 2008


On 14 Okt, 13:06, Paul Boddie <p... at boddie.org.uk> wrote:
> 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

[...]

> 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.

The vCard specification (RFC 2426 [1]) refers to RFC 2425 [2], which
says this in section 5.8.1:

  A logical line MAY be continued on the next physical line anywhere
  between two characters by inserting a CRLF immediately followed by a
  single white space character (space, ASCII decimal 32, or horizontal
  tab, ASCII decimal 9).

This is like the iCalendar specification (RFC 2445 [3]), section 4.1:

  Lines of text SHOULD NOT be longer than 75 octets, excluding the
line
  break. Long content lines SHOULD be split into a multiple line
  representations using a line "folding" technique. That is, a long
  line can be split between any two characters by inserting a CRLF
  immediately followed by a single linear white space character (i.e.,
  SPACE, US-ASCII decimal 32 or HTAB, US-ASCII decimal 9).

I didn't find anything which forbids splitting quoted-printable
character values in these specifications.

Paul

[1] http://www.ietf.org/rfc/rfc2426.txt
[2] http://www.ietf.org/rfc/rfc2425.txt
[3] http://www.ietf.org/rfc/rfc2445.txt



More information about the Python-list mailing list