# Vpim::Vcard Line Breaks

**URL:** <https://www.ruby-forum.com/t/vpim-vcard-line-breaks/57528>\
**Category:** Ruby\
**Created:** [April 11, 2006, 7:31pm UTC](https://www.ruby-forum.com/t/vpim-vcard-line-breaks/57528 "2006-04-11T19:31:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dabeeeenster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ed655f/32.png) [@dabeeeenster](https://www.ruby-forum.com/u/dabeeeenster)\
**Post date:** [April 11, 2006, 7:31pm UTC](https://www.ruby-forum.com/t/vpim-vcard-line-breaks/57528/1 "2006-04-11T19:31:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dabeeeenster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ed655f/32.png) [@dabeeeenster](https://www.ruby-forum.com/u/dabeeeenster)\
**Post date:** [April 11, 2006, 8:37pm UTC](https://www.ruby-forum.com/t/vpim-vcard-line-breaks/57528/2 "2006-04-11T20:37:15Z")

</div>

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

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
