Re: libvc 003 released with vCard 2.1 compatibility and question for the public
Sam Roberts <[email protected]> Fri, 20 Jun 2003 23:52:24 -0400
| Newsgroups | gmane.ietf.vcard |
|---|---|
| Message-ID | <[email protected]> |
Quoteing [email protected], on Fri, Jun 20, 2003 at 11:22:45AM -0700: > I will take a look at this. The one thing important > to me in one project that I am working on is to > support Japanese vCard with the Furigana or Ruby. I've a Ruby vCard decoding library on the RAA: http://raa.ruby-lang.org/list.rhtml?name=vcard It supports single-byte and utf-8 encodings. Supporting UTF-16 is easy, I think. If the first byte is 0x00, then it must be UTF-16, and you can convert the whole vCard to utf-8. I haven't integrated this into the vCard decoder itself, but I suppose I could. An example of doing this is osx-wwrappers.rb, where I do this to vCards I retrieve from the OS X AddressBook application if it gives them to me as UTF-16. There, I use the NSString to do the conversion, doing it with iconv.rb would be more portable. I haven't had a lot of incentive to add decoding utf-16 or vCard2.1, despite that its an hour or so's work, because there seems to be no interest in a Ruby vCard decoder, but if you're interested, maybe I'll add this support next week. > > Question for the public: I've two opinions on this: 1 - if you store paramaters in a data structure, where each param maps to an array of values (which it does), then if you see type= more than once, you won't have any troubles: Foo;type=a,b;type=c;d:something Will decode fine, every time you see a param with a previously seen name, you just keep appending values to the array, and type will have the 3 values a, b, c, and d at the end. Issues of human friendly or not become irrelevant then. It's kindof readable, but we should decode the EBNF, not just limit ourselves to what we think looks nice when its encoded. 2 - From my experience with S/MIME and ASN.1, I would say you should always preserve the original encoding, never recode. So, when you decode a line, keep the original value. When you reencode, if the values haven't changed, put out exactly the same line. Reencoding works assuming: - it was encoded perfectly in the original - you decoded it perfectly - you reencoded it perfectly It's like playing telephone, when you whisper in your neighbours ear, and they whisper in theirs - it always gets screwed up somewhere. Its more robust to extract the info you need, as best you can, and leave the vCard alone. That's my two bits. Cheers, Sam