ihabunek / pdf417-py

PDF417 barcode generator for Python
Other
84 stars 28 forks source link

Error to decode the original string. #8

Closed jhechenl closed 7 years ago

jhechenl commented 7 years ago

Sometimes when decoding the created image of PDF417, it is decoded with different characters, especially when working with an XML.

For example:

<A atributte="Hola"> AbcdeFGH ...... </a> And in pdf417 would be:

<A atributte="Hola"> "bcdeFGH ...... </a>

ihabunek commented 7 years ago

@jhechenl Hi, could you give me an exact example which decodes incorrectly. I tried your example, and it seems to work fine when decoded with https://pdf417.mobi/

ihabunek commented 7 years ago

Also, what do you use for decoding?

jhechenl commented 7 years ago

Sorry for the late:

Original Input:

<TED xmlns="http://www.sii.cl/SiiDte" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"><DD><RE>76056135-5</RE><TD>33</TD><F>4</F><FE>2017-04-20</FE><RR>78577220-2</RR><RSR>OPTICA JADUE Y ULLOA LTDA</RSR><MNT>2184440</MNT><IT1>Pintura B&amp;W AFECTO</IT1><CAF version="1.0"><DA><RE>76056135-5</RE><RS>CONSULTORA FECCI LIMITADA</RS><TD>33</TD><RNG><D>1</D><H>60</H></RNG><FA>2017-04-20</FA><RSAPK><M>ueGDJS287kOAXtxlPgH6F4EiIvlRPIS1l9gulW+DGASC2GcV99f+Ez6d5XO1hSDFTuV7aO8X77znsfOyucfmtw==</M><E>Aw==</E></RSAPK><IDK>100</IDK></DA><FRMA algoritmo="SHA1withRSA">B+xH+yNJ2i7mfLZ5XnhMqbsqaXOtxi+yi/V0wPZ3a/EmkSSs+AdovzGOJkPPLderM5emxndKykLpMo5pyNZX8Q==</FRMA></CAF><TSTED>2017-04-20T20:10:53</TSTED></DD><FRMT algoritmo="SHA1withRSA">g3KJkEgKQj7B4GJUHFZXF7GfoQf6ND4ySNJKZaiO9bQf1CaekqOgL+ebDKubQ8ycMu1buvaI6inJ0vsj70YNLg==</FRMT></TED>

Output pdf417:

barcode

Output string:

<TED xmlns="http://www.sii.cl/SiiDte" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"><DD><RE>76056135-5</RE><TD>33</TD><F>4</F><FE>2017-04-20</FE><RR>78577220-2</RR><RSR>OPTICA JADUE Y ULLOA LTDA</RSR><MNT>2184440</MNT><IT1>Pintura B&amp;W AFECTO</IT1><CAF version="1.0"><DA><RE>76056135-5</RE><RS>CONSULTORA FECCI LIMITADA</RS><TD>33</TD><RNG><D>1</D><H>60</H></RNG><FA>2017-04-20</FA><RSAPK><M>ueGDJS287kOAXtxlPgH6F4EiIvlRPIS1l9gulW+DGASC2GcV99f+Ez6d5XO1hSDFTuV7aO8X77znsfOyucfmtw==</M><E>Aw==</E></RSAPK><IDK>100</IDK></DA><FRMA algoritmo="SHA1withRSA">B+xH+yNJ2i7mfLZ5XnhMqbsqaXOtxi+yi/V0wPZ3a/EmkSSs+AdovzGOJkPPLderM5emxndKykLpMo5pyNZX8Q==</FRMA></CAF><TSTED>2017-04-20T20:10:53</TSTED></DD><FRMT algoritmo="SHA1withRSA">"3KJkEgKQj7B4GJUHFZXF7GfoQf6ND4ySNJKZaiO9bQf1CaekqOgL+ebDKubQ8ycMu1buvaI6inJ0vsj70YNLg==</FRMT></TED>

In the node FRMT change the first character.

And the decode in this page: https://zxing.org/w/decode.jspx

ihabunek commented 7 years ago

Thanks, I can reproduce that. Will look into it.

dansanti commented 7 years ago

Hi! i have the same bug:

....<FRMT algoritmo="SHA1withRSA">gY2...

g was replaced by "

...<FRMT algoritmo="SHA1withRSA">"Y2....

is a random bug, but in the same place

ihabunek commented 7 years ago

Ok, the problem was that one of the characters in the character map was wrong. Fixed now and released in 0.6.0. Please upgrade and test.