--- /dev/null
+#!perl -w
+
+use strict;
+use Test::More tests => 2;
+
+use HTML::Parser ();
+
+my $dtext = "";
+my $text = "";
+
+sub append
+{
+ $dtext .= shift;
+ $text .= shift;
+}
+
+my $p = HTML::Parser->new(text_h => [\&append, "dtext, text"],
+ default_h => [\&append, "text, text" ],
+ );
+
+my $doc = <<'EOT';
+<title>å</title>
+<a href="fooå">ååAA<A>AA</a>
+<?å>
+foo bar
+foo bar
+&xyzzy
+&xyzzy;
+<!-- � -->
+
+ÿ
+ÿ
+ÿG
+<!-- Ā -->
+�
+�
+&
+&#
+&#x
+<xmp>å</xmp>
+<script>å</script>
+<ScRIPT>å</scRIPT>
+<skript>å</script>
+EOT
+
+$p->parse($doc)->eof;
+
+is($text, $doc);
+is($dtext, <<"EOT");
+<title>å</title>
+<a href="fooå">ååAA<A>AA</a>
+<?å>
+foo\240bar
+foo\240bar
+&xyzzy
+&xyzzy;
+<!-- � -->
+\1
+\377
+\377
+\377G
+<!-- Ā -->
+�
+�
+&
+&#
+&#x
+<xmp>å</xmp>
+<script>å</script>
+<ScRIPT>å</scRIPT>
+<skript>å</script>
+EOT