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

Dmitry Kolesnikov <>
Wed Dec 4 14:57:58 CET 2013


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 <> 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
> 
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131204/05989db1/attachment.html>


More information about the erlang-questions mailing list