Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-139

[classlib][ICU] characters 0x0384 and 0xB7 are unmapped in ICU implementation of ISO8859-7

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • None
    • Classlib
    • None

    Description

      Looks like characters 0x0384 and 0xB7 are unmapped in ICU implementation. Mapping table could be found here: http://www.unicode.org/Public/MAPPINGS/ISO8859/8859-7.TXT
      Please use test below for reproducing:

      import java.nio.*;
      import java.nio.charset.*;
      import com.ibm.icu4jni.charset.CharsetProviderICU;

      import junit.framework.TestCase;

      public class Harmony139 extends TestCase{

      public static void main(String args[])

      { junit.textui.TestRunner.run(Harmony139.class); }

      public void testEncode_JIRA139_1() throws Exception {
      CharsetProviderICU provider = new CharsetProviderICU();
      Charset iso8859_7 = provider.charsetForName("ISO-8859-7");
      // Uncomment code below to use RI charset
      //Charset iso8859_7 = Charset.forName("ISO-8859-7");
      CharBuffer cb = CharBuffer.allocate(1);
      cb.put((char)0x0384); cb.flip();
      ByteBuffer bb = iso8859_7.newEncoder().replaceWith(new byte[]

      {0x3F}).onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE).encode(cb);
      assertEquals((byte)0xB4, bb.get(0));
      }

      public void testEncode_JIRA139_2() throws Exception {
      CharsetProviderICU provider = new CharsetProviderICU();
      Charset iso8859_7 = provider.charsetForName("ISO-8859-7");
      // Uncomment code below to use RI charset
      //Charset iso8859_7 = Charset.forName("ISO-8859-7");
      CharBuffer cb = CharBuffer.allocate(1);
      cb.put((char)0xB7); cb.flip();
      ByteBuffer bb = iso8859_7.newEncoder().replaceWith(new byte[] {0x3F}

      ).onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE).encode(cb);
      assertEquals((byte)0xB7, bb.get(0));
      }
      }

      Both tests passed with RI, and failed with Harmony.

      Attachments

        Activity

          People

            tellison Tim Ellison
            sva Vladimir Strigun
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: