Compression Algorithms for Strings

I need to generate QRCodes using the properties of concatenated objects. These lines can be long, so I would like to know which compression algorithm to use, knowing that my line length is from 25 to 100 characters

thanks in advance,

Jerec

+4
source share
2 answers

I assume that since you are going to use compression before storing lines that these QR codes will not be readable by any client, this should be the application that you wrote (b / c you store a character with an unknown encoding, the client does not will be able to decode).

Instead of compressing and saving a long string in a QR code, ask your application to create a URI (e.g. a GUID or URL), and when your application decodes that URI , it looks at all the values ​​(uncompressed) that you want to save in the QR code. Then your application can simply search for the format in whatever way it wants.

For example, if your persistent storage is an xml file, but it could be anything:

<URI = "http://mydomain.com/790C9704-8C61-435F-991D-CDBB5767AA3D"> <MyElement>14523</MyElement> <MyElement>67548</MyElement> ... <MyElement>46167</MyElement> </URI> 

Coded in QR code: "http://mydomain.com/790C9704-8C61-435F-991D-CDBB5767AA3D", then the values ​​can be viewed.

0
source

The algorithm used to encode QR codes depends on the type of data that you encode. See http://www.swetake.com/qr/qr1_en.html .

If you know, for example, that you always have the same number of digits per identifier, and therefore they can simply link them together without punctuation, you can encode them as purely numeric ones, and you will use 10 bits for every three characters.

If you need some kind of delimiter, if you use something in "0-9A-Z $% * + -. /:", You will remain alphanumeric and get 2 characters in 11 bits.

If you give it arbitrary data (note that this includes any lower case: lowercase letters are not listed in the above list), you will use 8 bits for each character.

Thus, the numerical number will be 60% less.

0
source

All Articles