dsiddharth2 / php-zxing

PHP wrapper for Zxing Java library
MIT License
126 stars 25 forks source link

Remove XML format when Decoding #15

Open andrespadron98 opened 5 years ago

andrespadron98 commented 5 years ago

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!

dsiddharth2 commented 5 years ago

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

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

andrespadron98 commented 5 years ago

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

alvaro-donoso commented 5 years ago

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

dsiddharth2 commented 5 years ago

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