01: /* J_LZ_COPYRIGHT_BEGIN *******************************************************
02: * Copyright 2001-2006 Laszlo Systems, Inc. All Rights Reserved. *
03: * Use is subject to license terms. *
04: * J_LZ_COPYRIGHT_END *********************************************************/
05:
06: package org.openlaszlo.test;
07:
08: import java.net.*;
09: import java.io.*;
10:
11: public class utf8dec {
12: public static void main(String[] args) throws IOException {
13:
14: ByteArrayOutputStream buf = new ByteArrayOutputStream();
15:
16: for (int i = 0; i < args.length; i++) {
17: String b = args[i];
18: buf.write(Integer.parseInt(b, 16));
19: }
20:
21: String out = new String(buf.toByteArray(), "UTF8");
22: for (int i = 0; i < out.length(); i++) {
23: System.out.print("&#" + ((int) out.charAt(i)) + "; ");
24: }
25:
26: System.out.println("");
27: for (int i = 0; i < out.length(); i++) {
28: System.out.print("0x" + Integer.toHexString(out.charAt(i))
29: + " ");
30: }
31: }
32:
33: }
|