php-zxing icon indicating copy to clipboard operation
php-zxing copied to clipboard

Remove XML format when Decoding

Open andrespadron98 opened this issue 6 years ago • 4 comments

I am decoding a bar code that is in XML format and when decoding it removes the <> plus what is inside the <>, what can be done?

Thank you!

andrespadron98 avatar Jun 20 '19 20:06 andrespadron98

Can I know how are you encoding the data into image?

Is there any example or any link that I can refer to?

dsiddharth2 avatar Jun 21 '19 02:06 dsiddharth2

I discovered that since I was showing it in XML, the tags I hid it, it was my mistake, but now when I decorate it, it does not show it completely, I try to decode this image: 1 (2)

and it does not give me the same information as here https://zxing.org/w/decode.jspx

it gives me less information

andrespadron98 avatar Jun 21 '19 13:06 andrespadron98

Same for me...when I use XML format text or tags (<>) inside the PDF-417 codebar, the script return the plain text with no tags.

I realized that the use of exec($command, $script_output); in PHPZxingDecoder.php make this behavior. I know this because I put the same command generated in the $command variable inside the terminal and it returned me the real value with tags (xml format).

So i suppose its something in the return of the value using the exec method.

EDIT: I solved it changing for $imageValue = htmlentities($output[$key + 2], ENT_XHTML); in the createImages() method from PHPZxingDecoder.php

alvaro-donoso avatar Sep 05 '19 16:09 alvaro-donoso

@Alvoxdns Hello, Can you fix and Raise a Pull Request, I will test and merge the fix. Thank you :)

dsiddharth2 avatar Oct 06 '19 10:10 dsiddharth2