相关文章推荐
乖乖的莲藕  ·  Python的pandas ...·  2 年前    · 
What encoding format is this ? " xx/r/x01/x03/x.../r/n" I need to convert it into format " 78780d0103...0d0a" . In python I am able to convert it properly using codecs and decode. hexbytedata = codecs.encode(received, " hex" ) hexdata = hexbytedata.decode( " utf-8" ) Can anyone help me for this in java?
What I have tried:
I have tried jython codec , xml.bind libraries options with no luck it's just characters - it's a string representation of the byte values.
Because you can't type "carriage return" (0x0d as a byte) and "line feed" (0x0a as a byte) values on a keyboard, many languages let you insert them to strings using an "escape character" followed by a normal character which says what byte value is to be generated. Often the escape characters is a backslash, but in this case it's a forward slash.
Common escape sequences would probably include:
/r 0x0d Carriage return /n 0x0a Line feed /t 0x09 Tab // 0x2f /In this case, the "/xyz" would problem mean "the byte value yz in hexadecimal".
  • Read the question carefully.
  • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  • Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
  •