package com.thaiopensource.xml.dtd;

public abstract class EncodingMap {
  static public String getJavaName(String enc) {
    return enc;
  }
}
  

@@ -34,107 +34,782 @@
 d;%0A%0A
-public abstract class EncodingMap %7B%0A  static public String getJavaName(String enc) %7B%0A    return enc
+import java.io.UnsupportedEncodingException;%0A%0Apublic abstract class EncodingMap %7B%0A  static String%5B%5D aliases = %7B%0A    %22UTF-8%22, %22UTF8%22,%0A    %22UTF-16%22, %22Unicode%22,%0A    %22UTF-16BE%22, %22UnicodeBigUnmarked%22,%0A    %22UTF-16LE%22, %22UnicodeLittleUnmarked%22,%0A    %22US-ASCII%22, %22ASCII%22,%0A    %22TIS-620%22, %22TIS620%22%0A  %7D;%0A      %0A  static public String getJavaName(String enc) %7B%0A    try %7B%0A      %22x%22.getBytes(enc);%0A    %7D%0A    catch (UnsupportedEncodingException e) %7B%0A      for (int i = 0; i %3C aliases.length; i += 2) %7B%0A%09if (enc.equalsIgnoreCase(aliases%5Bi%5D)) %7B%0A%09  try %7B%0A%09    %22x%22.getBytes(aliases%5Bi + 1%5D);%0A%09    return aliases%5Bi + 1%5D;%0A%09  %7D%0A%09  catch (UnsupportedEncodingException e2) %7B%7D%0A%09%7D%0A      %7D%0A    %7D%0A    return enc;%0A  %7D%0A%0A  static public void main(String%5B%5D args) %7B%0A    System.err.println(getJavaName(args%5B0%5D))
 ;%0A  

Proper implementation.