diff --git a/src/FritzBox/Converter.php b/src/FritzBox/Converter.php index 0468de81..a3ca04d5 100644 --- a/src/FritzBox/Converter.php +++ b/src/FritzBox/Converter.php @@ -35,8 +35,8 @@ public function convert($card) $this->addVip(); // add Person $person = $this->contact->addChild('person'); - $name = htmlspecialchars($this->getProperty('realName')); - $person->addChild('realName', $name); + $realName = htmlspecialchars($this->getProperty('realName')); + $person->addChild('realName', $realName); // add photo if (isset($this->card->rawPhoto) && isset($this->card->imageURL)) { if (isset($this->configImagePath)) { diff --git a/src/Vcard/Parser.php b/src/Vcard/Parser.php index a8b8359d..fd0726b6 100644 --- a/src/Vcard/Parser.php +++ b/src/Vcard/Parser.php @@ -165,6 +165,15 @@ protected function parse() $i++; } + // Unquote COMMA, SEMICOLON and BACKSPACE as per RFC 6350 chap. 3.4 + // https://tools.ietf.org/html/rfc6350#section-3.4 + // But we don't do this on potential binary data! + if (!$rawValue) { + $value = str_replace("\\,", ",", $value); // \, => , + $value = str_replace("\\;", ";", $value); // \; => ; + $value = str_replace("\\\\", "\\", $value); // \\ => \ + } + switch (strtoupper($element)) { case 'FN': $cardData->fullname = $value;