1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-18 07:52:21 +01:00

make sure that contact data are always utf8 encoded to avoid encoding problems

This commit is contained in:
Bjoern Schiessle 2012-06-11 16:26:21 +02:00
parent 0101088e95
commit cd06ab6e6e

View File

@ -63,13 +63,13 @@ foreach($lines as $line){
if(strtoupper(trim($line)) == 'BEGIN:VCARD'){ if(strtoupper(trim($line)) == 'BEGIN:VCARD'){
$inelement = true; $inelement = true;
} elseif (strtoupper(trim($line)) == 'END:VCARD') { } elseif (strtoupper(trim($line)) == 'END:VCARD') {
$card[] = $line; $card[] = iconv(mb_detect_encoding($line, 'UTF-8, ISO-8859-1'), 'utf-8', $line);
$parts[] = implode($nl, $card); $parts[] = implode($nl, $card);
$card = array(); $card = array();
$inelement = false; $inelement = false;
} }
if ($inelement === true && trim($line) != '') { if ($inelement === true && trim($line) != '') {
$card[] = $line; $card[] = iconv(mb_detect_encoding($line, 'UTF-8, ISO-8859-1'), 'utf-8', $line);
} }
} }
//import the contacts //import the contacts