aobag-dev / jzebra

Automatically exported from code.google.com/p/jzebra
0 stars 0 forks source link

Problem when try to convert hex string C381 to byte array #215

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. When you call ByteUtilities.bytesToHex("Á".getBytes("UTF-8")) you have the 
result "C381", but when you try to convert back to string calling 
 ByteUtilities.hexStringToByteArray("C381") you catch the exception Value out of range. Value:"c3" Radix:16 

What is the expected output? What do you see instead?
Can use the special characters like "Á"

What version of the product are you using? On what operating system?
qz 1.8.0

Please provide any additional information below.

I get the algoritm from class org.springframework.security.crypto.codec.Hex and 
it works perfectly.

Original issue reported on code.google.com by fabianac...@gmail.com on 3 Apr 2014 at 8:19

Attachments:

GoogleCodeExporter commented 8 years ago
Does it error if you do getBytes("UTF-16") ?

There's an outstanding bug issue 191, not sure if that's what you are 
encountering.

https://code.google.com/p/jzebra/issues/detail?id=191

If it is a duplicate of this issue, it should be corrected for future 2.0.0 
release:

https://github.com/qzindustries/qz-print/blob/master/qz-print/src/qz/ByteUtiliti
es.java#L53

Original comment by tres.fin...@gmail.com on 4 Apr 2014 at 5:02

GoogleCodeExporter commented 8 years ago
Yes, it will solve the problem. Tks

Original comment by fabianac...@gmail.com on 7 Apr 2014 at 1:03