summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorUrban Müller2012-03-22 18:48:52 +0000
committerUrban Müller2012-03-22 18:48:52 +0000
commit4574035ec43cabf050a7ab036bbba1cd2447a18f (patch)
tree16466e433101daab1fd24afd25d77e18551c8754 /tests
parent8d9bcc5de7ebf6d44fea96bfea920a77c7fcbd00 (diff)
downloaditools-4574035ec43cabf050a7ab036bbba1cd2447a18f.tar.gz
itools-4574035ec43cabf050a7ab036bbba1cd2447a18f.tar.bz2
itools-4574035ec43cabf050a7ab036bbba1cd2447a18f.zip
check encoding in Q() and _tag(), adapt tests to utf-8
Diffstat (limited to 'tests')
-rwxr-xr-xtests/it_html.t42
1 files changed, 27 insertions, 15 deletions
diff --git a/tests/it_html.t b/tests/it_html.t
index 0def431..c955359 100755
--- a/tests/it_html.t
+++ b/tests/it_html.t
@@ -4,6 +4,7 @@
# Tests for html.class
# Traditional html generation
+ini_set('default_charset', "utf-8");
new it_html(array('htmltype' => "html"));
is(
@@ -95,30 +96,22 @@ is(
<P><a href="javascript:window.close()" title="Wolken"><img src="http://farm1.static.flickr.com/177/377214376_bcba167a7d_m.jpg" width="240" height="180" alt="Wolken" style="border: 1px solid #ddd;" /></a></p>
'),
- ' <a href="http://www.flickr.com/people/swisspics%25/">swisspics</a> posted &lt; &lt; &amp; yesterday a <i>photo</i> <i>tag missmatch</i>:<br /><br /> <p><img src="http://farm1.static.flickr.com/177/377214376_bcba167a7d_m.jpg" alt="" /></p> ',
+ ' <a href="http://www.flickr.com/people/swisspics%25/">swisspics</a> posted &lt; &lt; ä &amp; yesterday a <i>photo</i> <i>tag missmatch</i>:<br /><br /> <p><img src="http://farm1.static.flickr.com/177/377214376_bcba167a7d_m.jpg" alt="" /></p> ',
'it_html::sanitize tag soup'
);
is(
it_html::sanitize('q&#8592;x'),
- "q&#8592;x",
+ "q←x",
'it_html::sanitize preserve numeric entities'
);
-it_html::configure(array('charset' => "utf-8"));
is(
it_html::sanitize('q&uuml;x'),
"q\xc3\xbcx",
'it_html::sanitize with utf-8'
);
-it_html::configure(array('charset' => "iso-8859-1"));
-is(
- it_html::sanitize('q&uuml;x'),
- "q\xfcx",
- 'it_html::sanitize with latin1'
-);
-
is(
it_html::sanitize('<b>a<br>b</b>'),
"<b>a<br />b</b>",
@@ -126,8 +119,8 @@ is(
);
is(
- U("/foo.html", array('bar' => array('gna' => 42, 'qux' => array('quux' => "<Zrich>", 'gnp' => "fasel")))),
- '/foo.html?bar[gna]=42&bar[qux][quux]=%3CZ%FCrich%3E&bar[qux][gn%F6p]=fasel',
+ U("/foo.html", array('bar' => array('gna' => 42, 'qux' => array('quux' => "<Zürich>", 'gnöp' => "fasel")))),
+ '/foo.html?bar[gna]=42&bar[qux][quux]=%3CZ%C3%BCrich%3E&bar[qux][gn%C3%B6p]=fasel',
'U() with nested arrays'
);
@@ -149,11 +142,30 @@ is(
'U() converting of \ to /'
);
-is(it_html::entity_decode("&auml;"), "");
-is(it_html::entity_decode("&#8217;"), "'");
+is(it_html::entity_decode("&auml;"), "ä");
is(it_html::entity_decode("&#x4a;"), "J");
is(it_html::entity_decode("&#x4A;"), "J");
-is(it_html::entity_decode("&#xfff;"), " ");
is(it_html::entity_decode("&#65;"), "A");
+
+
+#
+# check transliterations in iso-8859-1
+#
+
+it_html::configure(array('charset' => "iso-8859-1"));
+
+is(
+ it_html::sanitize('q&uuml;x'),
+ "q\xfcx",
+ 'it_html::sanitize with latin1'
+);
+
+is(
+ it_html::sanitize('q&#8592;x'),
+ "q&#8592;x",
+ 'it_html::sanitize preserve non-decodable numeric entities'
+);
+is(it_html::entity_decode("&#8217;"), "'");
+is(it_html::entity_decode("&#xfff;"), " ");
is(it_html::entity_decode("&#999;"), " ");
?>