#24 Encoding problem in EPPTransportTCP

RTK Java 0.3.10
open
nobody
5
2005-11-30
2005-11-30
tj2eek
No

In EPPTransportTCP (epp0705) writeToServer uses
String.getBytes() which uses the machines default
encoding. When using german umlaut this results in
invalid UTF-8 characters (the xml string shows UTF-8 as
charset). Furthermore calculation of the length of the
epp-packet is wrong when multibyte-chars occur in the
byte-representation.

Current code is this:
int len = final_xml.length();
writeBufferSize(writer_to_server_, len + INT_SZ);
writer_to_server_.write(final_xml.getBytes(), 0, len);

We suggest to change it like this:
byte bytebuf[] = final_xml.getBytes("UTF-8");
int len = bytebuf.length;
writeBufferSize(writer_to_server_, len + INT_SZ);
writer_to_server_.write(bytebuf, 0, len);

Regards,
tk

Discussion


  • Anonymous
    2010-06-24

    Hi

    We are developing the registrar Software for DotMasr (.مصر), we are using the great epp-rtk api

    we faced the same problem when we send Arabic characters in the xml requests, we discovered the same problem and we solved it by the same suggested solution and it works perfectly
    we hope it's fixed on the next release

     
  • This will be fixed in the next release.