Vpim::Vcard Line Breaks

Hello ~

I am using the Ruby Vpim library to create Vcards. I am having
trouble getting my address entries to format correctly when the
resulting VCF file is loaded into an address book. Is there a special
character to create a break line in the address field? Many of the
addresses in my data include multiple line addresses and they are
being forced into one line.

Thx in advance!

~ Ben

On Wed, Apr 12, 2006 at 02:29:50AM +0900, Ben R. wrote:

I am using the Ruby Vpim library to create Vcards. I am having
trouble getting my address entries to format correctly when the
resulting VCF file is loaded into an address book. Is there a special
character to create a break line in the address field? Many of the
addresses in my data include multiple line addresses and they are
being forced into one line.

Hi Ben,

Lets move this conversation over to vpim-talk, so we don’t take up the
attention of the entire ruby world. :slight_smile:

Here’s an example of encoding a multiline street with vpim-0.360:

% cat ex_multiline.rb
require ‘vpim/vcard’

card = Vpim::Vcard::Maker.make2 do |maker|
maker.add_name do |name|
name.prefix = ‘Dr.’
name.given = ‘Jimmy’
name.family = ‘Death’
end

maker.add_addr do |addr|
addr.preferred = true
addr.location = ‘work’
addr.street = “12 Last Row,\n13th Section”
addr.locality = ‘City of Lost Children’
addr.country = ‘Cinema’
end
end

puts card

card = Vpim::Vcard.decode(card.to_s).first

puts “—”
puts card.address.street
puts “—”

% ruby -I …/lib -w ex_multiline.rb
BEGIN:VCARD
VERSION:3.0
N:Death;Jimmy;;Dr.;
FN:Dr. Jimmy Death
ADR;TYPE=work,pref:;;12 Last Row,\n13th Section;City of Lost
Children;;;Cin
ema
END:VCARD

12 Last Row,
13th Section

So, I think it works.

If a card encoded like this doesn’t import correctly into your address
book
app, I’d like to see a card exported from your address book program that
has
newlines in the address fields, to see how it thinks things should be
done.

Also, the code you use to encode the address and the version of Vpim you
are
using would be helpful, and an example of a card you’ve encoded.

Cheers,
Sam