Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

my current point of research regarding encodings

git-svn-id: https://svn.php.net/repository/pear/packages/XML_Parser/trunk@266400 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit 532eee26f9fdf955b9af6bf3d3546134c1672227 1 parent 258af3e
Chuck Burgess authored
Showing with 12 additions and 8 deletions.
  1. +12 −8 tests/005.phpt
View
20 tests/005.phpt
@@ -22,8 +22,8 @@ require_once "XML/Parser.php";
class TestEncodings1 extends XML_Parser {
var $output = '';
- function TestEncodings1($to, $from) {
- $this->XML_Parser($from, 'event', $to);
+ function TestEncodings1($to, $mode, $from) {
+ $this->XML_Parser($from, $mode, $to);
}
function startHandler($xp, $elem, $attribs) {
$this->output .= "<$elem>";
@@ -35,16 +35,20 @@ class TestEncodings1 extends XML_Parser {
$this->output .= $data;
}
function test($data) {
- // $this->output = '';
- $this->parseString($data, true);
- return $this->output;
+ $result = $this->parseString($data, true);
+ if (PEAR::isError($result)) {
+ return $result;
+ }
}
}
$xml = "<?xml version='1.0' ?>";
$input = array(
"UTF-8" => "<a>abcæøå</a>",
- "ISO-8859-1" => "<a>abcæøå</a>",
+
+ /* are these special chars allowed in ISO-8859-1 context??? */
+ "ISO-8859-1" => "<a>abcæøå</a>", // "ISO-8859-1" => "<a>abc¥<a>",
+
"US-ASCII" => "<a>abcaoa</a>"
);
@@ -55,12 +59,12 @@ foreach ($input as $srcenc => $string) {
continue;
}
print "Testing $srcenc -> $tgtenc: ";
- $p =& new TestEncodings1($tgtenc, $srcenc);
+ $p =& new TestEncodings1($tgtenc, 'event', $srcenc);
$e = $p->test($input[$srcenc]);
if (PEAR::isError($e)) {
printf("OOPS: %s\n", $e->getMessage());
} else {
- var_dump($e);
+ var_dump($p->output);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.