bodewig 2003/03/14 05:45:17
Modified:docs/manual/CoreTypes filterchain.html
src/etc/testcases/filters build.xml
src/main/org/apache/tools/ant/types FilterChain.java
Added: src/etc/testcases/filters/expected escapeunicode.test
src/etc/testcases/filters/input escapeunicode.test
src/main/org/apache/tools/ant/filters EscapeUnicode.java
src/testcases/org/apache/tools/ant/filters
EscapeUnicodeTest.java
Log:
New filter escapeunicode that translates non-ASCII characters to
\u1234 escapes.
addresses PR: 17506
Revision ChangesPath
1.5 +29 -1 ant/docs/manual/CoreTypes/filterchain.html
Index: filterchain.html
===
RCS file: /home/cvs/ant/docs/manual/CoreTypes/filterchain.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- filterchain.html 3 Sep 2002 15:24:08 - 1.4
+++ filterchain.html 14 Mar 2003 13:45:16 - 1.5
@@ -89,6 +89,7 @@
nested elements.BR
a href=#filterreaderFilterReader/aBR
a href=#classconstantsClassConstants/aBR
+a href=#escapeunicodeEscapeUnicode/aBR
a href=#expandpropertiesExpandProperties/aBR
a href=#headfilterHeadFilter/aBR
a href=#linecontainsLineContains/aBR
@@ -162,6 +163,33 @@
lt;/loadpropertiesgt;
/PRE/BLOCKQUOTE
+H3a name=escapeunicodeEscapeUnicode/a/H3
+P
+This filter converts its input by changing all non US-ASCII characters
+into their equivalent unicode escape backslash u plus 4 digits./p
+
+Pemsince Ant 1.6/em/p
+
+H4Example:/H4
+
+This loads the basic constants defined in a Java class as Ant properties.
+BLOCKQUOTEPRE
+lt;loadproperties srcfile=quot;non_ascii_property.propertiesquot;gt;
+ lt;filterchaingt;
+lt;filterreader
classname=quot;org.apache.tools.ant.filters.EscapeUnicodequot;/gt;
+ lt;/filterchaingt;
+lt;/loadpropertiesgt;
+/PRE/BLOCKQUOTE
+
+Convenience method:
+BLOCKQUOTEPRE
+lt;loadproperties srcfile=quot;non_ascii_property.propertiesquot;gt;
+ lt;filterchaingt;
+lt;escapeunicode/gt;
+ lt;/filterchaingt;
+lt;/loadpropertiesgt;
+/PRE/BLOCKQUOTE
+
H3a name=expandpropertiesExpandProperties/a/H3
P
If the data contains data that represents Ant
@@ -629,5 +657,5 @@
HR
-P align=centerCopyright copy; 2002 Apache Software Foundation. All rights
+P align=centerCopyright copy; 2002-2003 Apache Software Foundation. All
rights
Reserved./P/BODY/HTML
1.2 +21 -2 ant/src/etc/testcases/filters/build.xml
Index: build.xml
===
RCS file: /home/cvs/ant/src/etc/testcases/filters/build.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- build.xml 30 Sep 2002 12:08:20 - 1.1
+++ build.xml 14 Mar 2003 13:45:16 - 1.2
@@ -6,18 +6,37 @@
/target
target name=cleanup
-delete dir=result /
+delete dir=result/
/target
target name=testLineContains depends=init
copy todir=result
- fileset dir=input/
+ fileset dir=input
+include name=linecontains.test/
+ /fileset
filterchain
filterreader classname=org.apache.tools.ant.filters.LineContains
param type=contains value=beta/
/filterreader
/filterchain
/copy
+!--fixcrlf srcdir=result eol=lf
+ include name=linecontains.test/
+/fixcrlf--
+ /target
+
+ target name=testEscapeUnicode depends=init
+copy todir=result encoding=UTF-8
+ fileset dir=input
+include name=escapeunicode.test/
+ /fileset
+ filterchain
+escapeunicode/
+ /filterchain
+/copy
+fixcrlf srcdir=result eol=crlf
+ include name=escapeunicode.test/
+/fixcrlf
/target
/project
1.1 ant/src/etc/testcases/filters/expected/escapeunicode.test
Index: escapeunicode.test
===
#hebrew shalom olam (hello world)
text.hebrew=\u05e9\u05dc\u05d5\u05dd \u05e2\u05d5\u05dc\u05dd
#goethe gingko biloba
text.german.1=Sp\u00fcrst du nicht an meinen Liedern,
text.german.2=Da\u00df ich eins und doppelt bin ?
# Francois Villon Ballade des Pendus
text.french=Fr\u00e8res humains qui apr\u00e8s nous vivez
# Usual IT example
text.basic.latin=Hello World
1.1 ant/src/etc/testcases/filters/input/escapeunicode.test
Index: escapeunicode.test
===
#hebrew shalom olam (hello world)
text.hebrew=שלום עולם
#goethe gingko biloba
text.german.1=Spürst du nicht an meinen Liedern,
text.german.2=Daß ich eins und doppelt bin ?
# Francois