db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4757) (Client) Implement UTF8 support on DRDA
Date Mon, 13 Sep 2010 12:20:33 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908740#action_12908740

Knut Anders Hatlen commented on DERBY-4757:

I came across this method in Utf8CcidManager (client) added in one of the earlier patches:

    public char convertToJavaChar(byte sourceByte) {
        /* 1 byte = 0 to 255 which is the same in UTF-8 and ASCII */ 
        return (char)sourceByte;

I'm not sure how it's supposed to be used, since it is currently only called from one of the
tests, but it doesn't look quite right. The problem is that byte is a signed type, so for
non-ascii characters in the range 0x80-0xff the corresponding byte values are negative. When
casting that negative value to a char, we won't end up with a char in the 0x80-0xff range,
but rather with a char in the 0xff80-0xffff range.

To expose this problem, add these lines to Utf8CcsidManagerClientTest.testConvertToJavaChar()

    b = (byte) 0xe5;
    assertEquals('\u00e5', ccsidManager.convertToJavaChar(b));

and see the test fail with

    AssertionFailedError: expected:<å> but was:<¥>

> (Client) Implement UTF8 support on DRDA
> ---------------------------------------
>                 Key: DERBY-4757
>                 URL: https://issues.apache.org/jira/browse/DERBY-4757
>             Project: Derby
>          Issue Type: Sub-task
>          Components: Network Client
>    Affects Versions:
>            Reporter: Tiago R. Espinha
>            Assignee: Tiago R. Espinha
>         Attachments: DERBY-4757_donotcommit.diff, DERBY-4757_p1.diff, DERBY-4757_p2.diff,
DERBY-4757_p3.diff, DERBY-4757_p3.diff
> This issue is DERBY-4746's counterpart for the client changes required to implement UTF8
support in DRDA.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message