Re: VCard decoder
Re: VCard decoder
- Subject: Re: VCard decoder
- From: email@hidden
- Date: Mon, 4 Jun 2001 20:07:35 -0400
On 6/3/2001 1:15 PM, "Jan Erik Mostrvm" <email@hidden> wrote:
>
Has anyone written a VCard decoder?
I don't have a full decoder, but in order to feed a stream of vCards into
Entourage, I created some utilities that might be useful. One bursts a stack of
vCards into individual cards (Entourage can only read one card per file).
Another renames the file to match the name in the vCard. This second utility
works through the vCard looking for various fields that may be useful as a name:
first the N: fields, then the FN: field, and then the ORG field. I'm proud of
the fact that it handles a range of odd combinations of first and last names, so
your vCards for Prince, Charo, and Khan won't be mangled. :-)
The renamer is based on a vCard script object. The vCard script object is
constructed from the text version of the vCard, and this construction process
unfolds any folded lines IAW RFC 2425. The vCard object then provides handlers
to get any property of the vCard (property in the vCard sense), and to get the
substrings of a property as a list. (The trick is that substrings are delimited
by semicolons, but semicolons are quoted with backslashes.) The script object
only handles "flat" vCards, not those with nested data. It also doesn't do any
decoding ("That step comes after you get the property substrings," he says,
ducking the issue.)
The package will be available on my web site,
http://www.purespeed.com/personal/snorton/
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden