Update of /cvsroot/xdoclet/xdoclet/modules/xdoclet/src/xdoclet/modules/externalizer
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29072/xdoclet/modules/xdoclet/src/xdoclet/modules/externalizer
Modified Files:
ExternalizerTagsHandler.java
Log Message:
convert characters with more than 8 bits into escaped unicode ones.
Allows for non iso-8859-x. From XDT-1025.
Index: ExternalizerTagsHandler.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/modules/xdoclet/src/xdoclet/modules/externalizer/ExternalizerTagsHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** ExternalizerTagsHandler.java 16 Aug 2004 13:46:40 -0000 1.5
--- ExternalizerTagsHandler.java 20 Aug 2004 05:15:58 -0000 1.6
***************
*** 23,26 ****
--- 23,63 ----
/**
+ * contert native encoding character to escaped character.
+ *
+ * @param str
+ * @return
+ */
+ private static String convertToUnicodeEscape(String str)
+ {
+ StringBuffer buf = new StringBuffer();
+
+ buf.setLength(0);
+
+ int pos = 0;
+
+ while (pos < str.length()) {
+ char c = str.charAt(pos);
+
+ pos++;
+ if (c >= 0x100) { // Only characters >8 bit -- leave iso-8859-x alone
+ String hex = Integer.toHexString(c);
+
+ buf.append("\\u0000".substring(0, 6 - hex.length()));
+ buf.append(hex);
+ }
+ else {
+ switch (c) {
+ case '\t':
+ buf.append("\\t");
+ break;
+ default:
+ buf.append(c);
+ }
+ }
+ }
+ return buf.toString();
+ }
+
+ /**
* Evaluate the body for all field tags. Works only in context of
ExternalizerSubTask.
*
***************
*** 79,83 ****
public String value() throws XDocletException
{
! return currentValue;
}
}
--- 116,120 ----
public String value() throws XDocletException
{
! return convertToUnicodeEscape(currentValue);
}
}
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel