ranguard / text-vcard

Perl package to edit and create vCard(s) (RFC 2426)
22 stars 15 forks source link

Disable charset conversation for as_string #6

Closed mhei closed 10 years ago

mhei commented 11 years ago

Hi,

I tested this module while trying to export my horde address book and importing it into my Nokia mobile phone. At this point I wondered about my german umlaute which got lost during import. After digging into this material I found that the charset conversation does not yet work, so lets drop it for the moment. Please find details in the commit message(s).

BR, Michael

ranguard commented 11 years ago

Hi,

I'd really rather merge a fix, instead of removing a feature that someone else added.

Could you supply a test case of it breaking please.

Thanks

Leo

mhei commented 11 years ago

Testscript:

#!/usr/bin/perl
use Text::vCard::Addressbook;

my $address_book = Text::vCard::Addressbook->new( { 'source_file' => 'addresslist.vcf' } );

foreach my $vcard ( $address_book->vcards() ) {
    print "Got card for " . $vcard->fullname() . "\n";

    open VCF, "> " . $vcard->fullname() . ".vcf" or die $!;
    print VCF $vcard->as_string();
    close VCF;
}

addresslist.vcf

BEGIN:VCARD
VERSION:2.1
FN;ENCODING=QUOTED-PRINTABLE;CHARSET=utf-8:Bartholom=C3=A4us von St=C3=BCrm=
er
N;ENCODING=QUOTED-PRINTABLE;CHARSET=utf-8:von St=C3=BCrmer;Bartholom=C3=A4u=
s;;;
TEL;CELL:+08154711
END:VCARD
BEGIN:VCARD
VERSION:2.1
FN;ENCODING=QUOTED-PRINTABLE;CHARSET=utf-8:Carl Gau=C3=9F
N;ENCODING=QUOTED-PRINTABLE;CHARSET=utf-8:Gau=C3=9F;Carl;;;
TEL;VOICE:+471112345
END:VCARD

The test script uses the address list file and exports each contact to a dedicated file. Note that there is no charset change requested as there is no parameter set for as_string. However, the internal default of utf-8 is used. When I run this script under my Ubuntu system, then e.g. the name Gauß is encoded twice as Gau=C3=83=C2=9F is the output file.

ranguard commented 10 years ago

Will release in a couple of weeks, kablamo making more changes soon