Pergunta

I'm trying to send data from the server written in Erlang:

gen_tcp:send(Socket, "Server connection refused \r\n").

It's ok. But when I try to send data with non-latin symbols, e. g. cyrillic, I see the error report. For example if i use:

gen_tcp:send(Socket, "Привет \r\n").

Instead of string I see error report. How do I send a string with non-latin characters via TCP socket from Erlang?

Foi útil?

Solução

Try this:

8> unicode:characters_to_binary("пириуэт да").
<<208,191,208,184,209,128,208,184,209,131,209,141,209,130,
  32,208,180,208,176>>
9>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top