• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error converting Hex to Ascii  RSS feed

 
Fernando Skackauskas
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I have a program that have the function of converting a string of 800 characters in Hex into Ascii.

Bellow the string in Hex:

09dff751ac98c0925a2170de275a31c5462df93e08c1c086e7e277710a66408d01c38792c93819fbbd2bea9177896a2f2c15f7441353bfca30c1f4a97015294133f2e8cb7f4ebd2bfd79aebcb772305a6b1620a89e45344344064d55cff87adfaf026089f7fd3117176ce075cc00ef8279eee9cc782263be3ce4d3c5c88a68213941f4e2c3f6266450f0e0b87395d9677204edd52034c1feeaf2b4cb0d8b629f8dbd6310da4c0c532c1716485c898b4d08a9802947333df8e61195939d42a8605a86624c6db2a7a295417d9d5e6e320aeb7d97cb801ef4345fc745d9c651210c527e5731d1fb5ebff9091136ae338ca2845b2da7575590a496c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc28


Bellow the Java program:



The correct output should be:

ß÷Q¬˜À’Z!pÞ'Z1ÅF-ù>ÁÀ†çâwq
f@Ç’É8û½+ê‘w‰j/,÷DS¿Ê0Áô©p)A3òèËN½+ýy®¼·r0Zk ¨žE4CDMUÏøz߯`‰÷ý1làuÌ


But the program converts completely wrong the Hex to Ascii. Bellow the conversion performed.


ß÷Q¬˜À’Z!pÞ'Z1ÅF-ù>ÁÀ†çâwq
f@ǒÉ8û½+ê‘w‰j/,÷DS¿Ê0Áô©p)A3òèËN½+ýy®¼·r0Zk ¨žE4CDMUÏøz߯`‰÷ý1làuÌ


What am I doing wrong in the program?

Thanks,

Fernando
 
Ahmed Bin S
Ranch Hand
Posts: 385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have posted code that doesn't even compile:



And then here again:


 
Campbell Ritchie
Marshal
Posts: 56593
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please start by explaining what the conversions are. 09 does not convert to ß, which is not actually an ASCII character anyway.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!