Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4267354

Codepages Updated with EURO don't have new IBM CCSIDs as aliases

XMLWordPrintable

      Name: bb33257 Date: 08/31/99


      The following code uses static arrays mapping the new IBM CCSIDs issued to
      support EURO conversion with the old ones.
      The code first attempts to open the codepages using the new CCSIDs,
      then checks for correct EURO conversion. If this fails then it uses
      the previous CCSID and attempts to check for correct EURO conversion.
      Some of these codepages were never supported.

      Thanks,


      import java.text.*;
      import java.util.*;
      import java.io.*;

      class printeurosupport
      {
        public static void main(String args[])
          {
            for (int i=0; i<euroCps.length; i++)
      {
      boolean found;
      try
      {
      found = IsEuroSupported(euroCps[i]);
      }
      catch (java.io.UnsupportedEncodingException x)
      {
      found = false;
      }

      if (found) System.out.println("SUPPORTED\t\t" + euroCps[i]);
      else
      {
      try
      {
      if (IsEuroSupported(euroCpsOld[i])) System.out.println("SUPPORTED\t\t" + euroCps[i] + "(thru " + euroCpsOld[i] + ")");

      }
      catch (java.io.UnsupportedEncodingException x)
      {
      System.out.println("UNSUPPORTED(never did)\t" + euroCps[i]);
      }
      }

      }
          }
        
        static boolean IsEuroSupported(String codepage) throws java.io.UnsupportedEncodingException
          {
            String Uni = new String(EURO_CHAR);
            byte[] Cp = Uni.getBytes(codepage);
            String BackUni = new String(Cp, codepage);
            
            if (!BackUni.equals(Uni)) System.out.println("UNSUPPORTED("+ Integer.toHexString(BackUni.charAt(0)) + "/" + Integer.toHexString(Uni.charAt(0)) + ")\t" + codepage);
            
            return (BackUni.equals(Uni));
          }
        
        final static char[] EURO_CHAR = { 0x20AC, 0x0000};
        final static String[] euroCps =
        {
         "Cp5346",
         "Cp5347",
         "Cp5348",
         "Cp5349",
         "Cp5350",
         "Cp5351",
         "Cp5352",
         "Cp5353",
         "Cp5354",
         "Cp1140",
         "Cp1141",
         "Cp1142",
         "Cp1143",
         "Cp1144",
         "Cp1145",
         "Cp1146",
         "Cp1147",
         "Cp1148",
         "Cp1149",
         "Cp858",
         "Cp923",
         "Cp924",
         "Cp859",
         "Cp17584",
         "Cp4971",
         "Cp9061",
         "Cp4909",
         "Cp1153",
         "Cp9044",
         "Cp1155",
         "Cp9049",
         "Cp1154",
         "Cp872",
         "Cp808",
         "Cp849",
         "Cp1158",
         "Cp848",
         "Cp1157",
         "Cp902",
         "Cp1156",
         "Cp901",
         "Cp16804",
         "Cp17248",
         "Cp5104",
         "Cp9238",
         "Cp12712",
         "Cp4899",
         "Cp867",
         "Cp1160",
         "Cp1161",
         "Cp1162",
         "Cp1164",
         "Cp1163",
         "Cp5354",
         "Cp8482",
         "Cp5123",
         "Cp16684",
         "Cp1390",
         "Cp1399",
         "Cp4930",
         "Cp1364",
         "Cp1362",
         "Cp1363",
         "Cp5210",
         "Cp21427",
         "Cp1370",
         "Cp1159",
         "Cp9027",
         "Cp1371" };


        final static String[] euroCpsOld =
        {
         "Cp1250",
         "Cp1251",
         "Cp1252",
         "Cp1253",
         "Cp1254",
         "Cp1255",
         "Cp1256",
         "Cp1257",
         "Cp1258",
         "Cp37",
         "Cp273",
         "Cp277",
         "Cp278",
         "Cp280",
         "Cp284",
         "Cp285",
         "Cp297",
         "Cp500",
         "Cp871",
         "Cp850",
         "Cp819",
         "Cp1047",
         "Cp850",
         "Cp13488",
         "Cp875",
         "Cp869",
         "Cp813",
         "Cp870",
         "Cp852",
         "Cp1026",
         "Cp857",
         "Cp1025",
         "Cp855",
         "Cp866",
         "Cp1131",
         "Cp1123",
         "Cp1125",
         "Cp1122",
         "Cp922",
         "Cp1112",
         "Cp921",
         "Cp420",
         "Cp864",
         "Cp1008",
         "Cp1046",
         "Cp424",
         "Cp803",
         "Cp862",
         "Cp9030",
         "Cp9066",
         "Cp-",
         "Cp1130",
         "Cp1129",
         "Cp1258",
         "Cp290",
         "Cp1027",
         "Cp300",
         "Cp930",
         "Cp939",
         "Cp4930",
         "Cp1364",
         "Cp1362",
         "Cp1363",
         "Cp1114",
         "Cp947",
         "Cp950",
         "Cp28709",
         "Cp835",
         "Cp937"
        };
      }



      (Review ID: 94673)

      ======================================================================</TEXTAREA>
      </td>
                          </tr>
                          <TR>
                            <TD colspan="2" bgcolor="#BFBFBF"> </td>
                          </tr>

      <a name="comments"></a>
                          <!-- COMMENTS -->
                          <TR>
                            <TD bgcolor="#BFBFBF" align="left" valign="bottom" height="24">
      <img src="/bugz/images/dot.gif" width="10">Comments
      </td>
                            <TD bgcolor="#BFBFBF" align="left" valign="bottom" height="24">
      <!-- BEGIN:TBR Mohan
        <A href="javascript:doDateStampSubmit(document.editbug_general, 'comments');"><font size="-1">[ Date Stamp ]</font></A>
      <img src="/bugz/images/dot.gif" width="18">
      END:TBR -->
      <A href="javascript:doFullPageSubmit(document.editbug_general, 'comments');"><font size="-1">[ Full Page ]</font></a>
      <img src="/bugz/images/dot.gif" width="22">
      <FONT size="-1" color="darkblue">--- Enter SUN Proprietary data here ---</font>
      </td>
                          </tr>

                          <TR>
                            <TD bgcolor="#BFBFBF" colspan="2" nowrap align="left">
      <img src="/bugz/images/dot.gif" width="5">
                              <TEXTAREA rows="6" cols="95" wrap="virtual" name="comments" align="left" bgcolor="white">

      Name: bb33257 Date: 08/31/99


      (company - Taligent , email - ###@###.###)

      ======================================================================
      ###@###.### 2003-09-23

            ilittlesunw Ian Little (Inactive)
            bcbeck Brian Beck (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: