You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "OKIBAYASHI, Masanori." <mo...@hm.aitai.ne.jp> on 2000/01/08 01:15:29 UTC
[PATCH] Tomcat3.0 for Multi-Byte Characters.
Hi, Everyone.
I tried to make a patch for Tomcat3.0. This patch makes
Tomcat3.0 to be able to write(or print) multi-byte characters.
---------->>>>> patch begins. <<<<<----------
--- src/share/org/apache/jasper/compiler/EscapeUnicodeWriter.java Wed Dec 15 17:49:50 1999
+++ EscapeUnicodeWriter.java Thu Jan 06 13:46:02 2000
@@ -74,7 +74,6 @@
*/
public class EscapeUnicodeWriter extends Writer {
private OutputStream out = null;
- private byte bytes[] = new byte[6];
public EscapeUnicodeWriter(OutputStream out) {
this.out = out;
@@ -88,19 +87,14 @@
int ci = off, end = off + len;
while ( --len >= 0 ) {
- int ch = buf[off++] & 0xff;
+ int ch = buf[off++];
/*
* Write out unicode characters as \u0000
*/
if ((ch < 0x20 || ch > 0x7e) &&
(ch != '\n' && ch != '\r' && ch != '\t')) {
- bytes[0] = (byte) '\\';
- bytes[1] = (byte) 'u';
- bytes[2] = (byte) Character.forDigit((ch & 0xf000) >> 12, 16);
- bytes[3] = (byte) Character.forDigit((ch & 0x0f00) >> 8, 16);
- bytes[4] = (byte) Character.forDigit((ch & 0x00f0) >> 4, 16);
- bytes[5] = (byte) Character.forDigit((ch & 0x000f) >> 0, 16);
- out.write(bytes);
+ String unicode = "\\u" + Integer.toString(ch, 16);
+ out.write(unicode.getBytes());
} else {
out.write((byte) ch);
}
---------->>>>> patch ends. <<<<<----------
Thanks.
moki@hm.aitai.ne.jp