On 11/16/07, masa henmi <[EMAIL PROTECTED]> wrote:
>
> I found a multi-byte character encoding probrem.
>
> The probrem case:
>
>      BSFManager manager = new BSFManager();
>
>      String japaneseHiragana = "'\u3042\u3044\u3046'"; // HIRAGANA A I U
>
>      Object ans = manager.eval("ruby", "(java)", 1, 1, japaneseHiragana);
>
>      System.out.println("ans = " + ans);
>
> Result:      BDF
>
>
> BEFORE =============== ByteList.java
>
> 119:    public ByteList append(int b) {
> 120:        append((byte)b);
> 121:        return this;
> 122:    }
>
> AFTER ================ ByteList.java
>
>     public ByteList append(int b) {
>         String wk = new String(new char[]{(char) b});
>
>         byte[] byArr = null;
>         try {
>               byArr = wk.getBytes("UTF8");
>         } catch (Exception ex) {
>                throw new RuntimeException(ex); // ??
>         }
>
>         for (int i = 0; i < byArr.length; i++) {
>               append(byArr[i]);
>         }
>         return this;
>     }
>

Thanks Masahito-san. Could you please store this report in our issue tracker?

http://jira.codehaus.org/browse/JRUBY

/Nick

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to