Skip Menu |

This queue is for tickets about the Net-CardDAVTalk CPAN distribution.

Report information
The Basics
Id: 120592
Status: new
Priority: 0/
Queue: Net-CardDAVTalk

People
Owner: Nobody in particular
Requestors: corion [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.05
Fixed in: (no value)



Subject: Net::CardDAVTalk::VCard double-encodes its input
Net::CardDAVTalk has some weird logic to try to determine whether its input is UTF-8 or not. This conflicts with the method that Text::VCardFast uses to decode its input, resulting in double-decoding and losing umlauts etc. The appropriate change in my opinion would be to change the subroutine Normalize and to comment out the automagic re-decoding of input: # If non-ascii value, it's utf-8 for (ref($Value) ? @$Value : $Value) { #if (/[\x80-\xff]/) { # $_ = eval { decode_utf8($_) } // $_; #} } This makes the attached test file pass. The problem manifests itself when Net::CardDAVTalk talks to my DAV server (davical) which serves already properly encoded data, but is easily reproducible by passing UTF-8 strings to Net::CardDAVTalk.
Subject: vcardfast-utf8.t
#!perl -w use strict; use Net::CardDAVTalk::VCard; use Text::VCardFast; use Data::Dumper; use Test::More tests => 2; my $vcard = join "", "BEGIN:VCARD\r\nVERSION:3.0\r\nFN:Hans M\N{LATIN SMALL LETTER U WITH DIAERESIS}ller", "\r\nTEL;TYPE=CELL;TYPE=VOICE:555-1267-789\r\nN:M\N{LATIN SMALL LETTER U WITH DIAERESIS}ller;Hans;;;\r\n", "PRODID:-//dmfs.org//mimedir.vcard//EN\r\nREV:20170101T000001Z\r\n", "\r\nEND:VCARD\r\n", ; my $contact_hash = vcard2hash($vcard); is $contact_hash->{objects}->[0]->{properties}->{fn}->[0]->{value}, "Hans M\N{LATIN SMALL LETTER U WITH DIAERESIS}ller", "Values don't get mojibaked by Text::VCardFast"; #$Data::Dumper::Useqq = 1; #diag Dumper $contact_hash; my $contact = Net::CardDAVTalk::VCard->new_fromstring($vcard); is $contact->VFN, "Hans M\N{LATIN SMALL LETTER U WITH DIAERESIS}ller", "Values don't get mojibaked by Net::CardDAVTalk";