[erlang-questions] Jinterface OtpErlangBinary utf-8 double encoding

Carl-Johan Kjellander carljohan.kjellander@REDACTED
Wed Dec 4 15:10:20 CET 2013


(moose@REDACTED)58> <<_:8, A1/utf8, A2/utf8>> = <<"Föö">>.
** exception error: no match of right hand side value <<"Föö">>

So what is the correct way of seeing it in the shell? Should I see it as
the correct character or the utf-8 encoded ones?

/cjk


On Wed, Dec 4, 2013 at 2:57 PM, Dmitry Kolesnikov <dmkolesnikov@REDACTED>wrote:

> Hello,
>
> This is correct UTF8 binary.
>
> unicode:characters_to_list(B).
> "Föö"
>
> <<_:8, A1/utf8, A2/utf8>> = <<"Föö">>.
> A1 = 246
>
> - Dmitry
>
> On Dec 4, 2013, at 3:15 PM, Carl-Johan Kjellander <
> carljohan.kjellander@REDACTED> wrote:
>
> I’m having utf-8 double encoding issues when sending binaries between Java
> and Erlang.
>
>         java.lang.String foo = new java.lang.String("Föö");
>         record[2] = new OtpErlangBinary(foo.getBytes());
>
> But of course that comes back as <<"Föö">> to my erlang node.
>
> Anyone have an idea why? Or how to fix? I'm compiling the java code with
> -encoding UTF-8 and using Erlang R15B (erts-5.9).
>
> /cjk
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131204/d514c2a2/attachment.htm>


More information about the erlang-questions mailing list