Index: CSS2.1-test-suite/Makefile
===================================================================
RCS file: /sources/public/CSS/CSS2.1-test-suite/Makefile,v
retrieving revision 1.13
diff -u -p -8 -r1.13 Makefile
--- CSS2.1-test-suite/Makefile	21 Aug 2007 14:47:14 -0000	1.13
+++ CSS2.1-test-suite/Makefile	30 Oct 2007 14:02:01 -0000
@@ -11,16 +11,20 @@ all:
 	find cooked-tests -name '*.xht' | xargs -n 1 --replace cp -Lv {} tests
 	find cooked-tests/* -maxdepth 0 -type d -not -name CVS | xargs -n 1 perl -e 'if (-d "$$ARGV[0]/support") { print `cp -Lrvu "$$ARGV[0]/support" tests` }'
 	#
 	# nuke unused support files and CVS directories
 	#
 	rm -rf tests/support/.unused
 	find tests -type d -name CVS | xargs rm -rf
 	#
+	# preprocess tests as necessary
+	#
+	egrep -l '&\w+;' tests/*.xht | xargs perl -pi -e 'use HTML::Entities::Numbered;' -e '$$_ = name2decimal_xml($$_)'
+	#
 	# empty distribution area
 	#
 	rm -rf dist/
 	mkdir dist
 	mkdir dist/html4
 	mkdir dist/xhtml1
 	mkdir dist/xhtml1print
 	#
Index: css3-color-test-suite/Makefile
===================================================================
RCS file: /sources/public/CSS/css3-color-test-suite/Makefile,v
retrieving revision 1.11
diff -u -p -8 -r1.11 Makefile
--- css3-color-test-suite/Makefile	23 Oct 2007 04:02:51 -0000	1.11
+++ css3-color-test-suite/Makefile	30 Oct 2007 14:02:01 -0000
@@ -17,16 +17,20 @@ all:
 	do                                                                    \
 		DESTFILE=`echo $$SRCFILE | sed 's/\.xhtml$$/.xht/;s/^src\///'`;\
 		DESTFILE=`echo $$DESTFILE | sed 's/\./-/g;s/-xht$$/.xht/'`;   \
 		DESTFILE=`echo $$DESTFILE | tr A-Z a-z`;                      \
 		DESTFILE=`echo -n $$DESTFILE | cut -d- -f1 | sed 's/\([1-9]\)/0\1/g'`-`echo $$DESTFILE | cut -d- -f2-`; \
 		cp -Lv $$SRCFILE $(STAGING_DIR)/$$DESTFILE;                   \
 	done
 	#
+	# preprocess tests as necessary
+	#
+	egrep -l '&\w+;' tests/*.xht | xargs perl -pi -e 'use HTML::Entities::Numbered;' -e '$$_ = name2decimal_xml($$_)'
+	#
 	# empty distribution area
 	#
 	rm -rf $(OUTPUT_DIR)
 	mkdir $(OUTPUT_DIR)
 	mkdir $(OUTPUT_DIR)/html4
 	mkdir $(OUTPUT_DIR)/xhtml1
 	mkdir $(OUTPUT_DIR)/xhtml1print
 	#
Index: CSS2.1-test-suite/lib/html.pm
===================================================================
RCS file: /sources/public/CSS/CSS2.1-test-suite/lib/html.pm,v
retrieving revision 1.2
diff -u -p -8 -r1.2 html.pm
--- CSS2.1-test-suite/lib/html.pm	20 Apr 2007 14:46:21 -0000	1.2
+++ CSS2.1-test-suite/lib/html.pm	30 Oct 2007 14:02:01 -0000
@@ -87,16 +87,28 @@ sub stringAsHTML {
     my($string, $cdataContext) = @_;
     die "string expected" if not defined $string or ref $string;
     unless ($cdataContext) {
         # not CDATA context, escape entities
         $string =~ s/&/&amp;/;
         $string =~ s/</&lt;/;
         $string =~ s/>/&gt;/;
         $string =~ s/"/&quot;/;
+
+        # also escape invisible chars so ppl can see them
+        $string =~ s/([\x00-\x08\x0B\x0C\x0E-\x1F])/sprintf('&#x%X;',ord($1))/eg; # control chars except \t\n
+        $string =~ s/\xA0/&nbsp;/g;
+        $string =~ s/\x2002/&ensp;/g;
+        $string =~ s/\x2003/&emsp;/g;
+        $string =~ s/\x2009/&thinsp;/g;
+        $string =~ s/\x200B/&#x200B;/g;
+        $string =~ s/\x200C/&zwnj;/g;
+        $string =~ s/\x200D/&zwj;/g;
+        $string =~ s/\x200E/&lrm;/g;
+        $string =~ s/\x200F/&rlm;/g;
     } elsif ($cdataContext == styleContext) {
         # perform any script conversions here
         # for now we assume that DOM3 Core support is in and that the
         # Web Apps assertion that HTML4 uses the XHTML namespace is
         # true, so getElementsByTagNameNS(), etc, are safe.
     } elsif ($cdataContext == scriptContext) {
         # perform any style conversions here
         # for now we assume that the Web Apps assertion that HTML4
Index: CSS2.1-test-suite/lib/xml.pm
===================================================================
RCS file: /sources/public/CSS/CSS2.1-test-suite/lib/xml.pm,v
retrieving revision 1.1
diff -u -p -8 -r1.1 xml.pm
--- CSS2.1-test-suite/lib/xml.pm	2 Dec 2004 16:06:44 -0000	1.1
+++ CSS2.1-test-suite/lib/xml.pm	30 Oct 2007 14:02:01 -0000
@@ -103,16 +103,29 @@ sub endTagAsXML {
 sub stringAsXML {
     my($string) = @_;
     die "string expected" if not defined $string or ref $string;
     $string =~ s/&/&amp;/gos;
     $string =~ s/</&lt;/gos;
     $string =~ s/>/&gt;/gos;
     $string =~ s/"/&quot;/gos;
     $string =~ s/'/&apos;/gos;
+
+    # also escape invisible chars so ppl can see them
+    $string =~ s/([\x00-\x08\x0B\x0C\x0E-\x1F])/sprintf('&#x%X;',ord($1))/eg; # control chars except \t\n
+    $string =~ s/\xA0/&nbsp;/g;
+    $string =~ s/\x2002/&ensp;/g;
+    $string =~ s/\x2003/&emsp;/g;
+    $string =~ s/\x2009/&thinsp;/g;
+    $string =~ s/\x200B/&#x200B;/g;
+    $string =~ s/\x200C/&zwnj;/g;
+    $string =~ s/\x200D/&zwj;/g;
+    $string =~ s/\x200E/&lrm;/g;
+    $string =~ s/\x200F/&rlm;/g;
+
     return $string;
 }
 
 sub CDATAAsXML {
     my($node) = @_;
     die "CDATA node expected" if not ref $node or $node->{nodeType} ne 'CDATA';
     my $output = '<![CDATA[';
     foreach my $child (@{$node->{childNodes}}) {


