text-vcard icon indicating copy to clipboard operation
text-vcard copied to clipboard

encoding_out is broken

Open citrin opened this issue 9 years ago • 0 comments

Sample code

use utf8;
use vCard;

my $vcard = vCard->new(encoding_out => 'cp1251');

$vcard->version('3.0');
$vcard->full_name('Иван Иванов');
$vcard->given_names([qw/Иван/]);
$vcard->family_names([qw/Иванoв/]);

print $vcard->as_string;

Output of this code

Wide character in print at ./encoding_out.pl line 18.
BEGIN:VCARD
VERSION;CHARSET=cp1251:3.0
N;CHARSET=cp1251:Иванoв;Иван;;;
FN;CHARSET=cp1251:Иван Иванов
END:VCARD

With string in utf-8, but should be

BEGIN:VCARD
VERSION:3.0
N;CHARSET=cp1251:Иванoв;Иван;;;
FN;CHARSET=cp1251:Иван Иванов
END:VCARD

with strings in cp-1251

I personally don't need this feature (discovered by accident) and think that better to have feature removed than broken. But it may be useful for transferring data to legacy software.

citrin avatar Sep 10 '16 02:09 citrin