parse(fopen(__FILE__, 'a')); } function testDecodeLatin1() { $vcard = <<setCharset('ISO-8859-1'); $vcard = $mimeDir->parse($vcard); $this->assertEquals("umlaut u - \xC3\xBC", $vcard->FN->getValue()); } function testDecodeInlineLatin1() { $vcard = <<parse($vcard); $this->assertEquals("umlaut u - \xC3\xBC", $vcard->FN->getValue()); } function testIgnoreCharsetVCard30() { $vcard = <<parse($vcard); $this->assertEquals("foo-bar - \xFC", $vcard->FN->getValue()); } function testDontDecodeLatin1() { $vcard = <<parse($vcard); // This basically tests that we don't touch the input string if // the encoding was set to UTF-8. The result is actually invalid // and the validator should report this, but it tests effectively // that we pass through the string byte-by-byte. $this->assertEquals("umlaut u - \xFC", $vcard->FN->getValue()); } /** * @expectedException \InvalidArgumentException */ function testDecodeUnsupportedCharset() { $mimeDir = new MimeDir(); $mimeDir->setCharset('foobar'); } /** * @expectedException \Sabre\VObject\ParseException */ function testDecodeUnsupportedInlineCharset() { $vcard = <<parse($vcard); } function testDecodeWindows1252() { $vcard = <<setCharset('Windows-1252'); $vcard = $mimeDir->parse($vcard); $this->assertEquals("Euro \xE2\x82\xAC", $vcard->FN->getValue()); } function testDecodeWindows1252Inline() { $vcard = <<parse($vcard); $this->assertEquals("Euro \xE2\x82\xAC", $vcard->FN->getValue()); } }