https://github.com/siara-cc/unishox_arduino_progmem_lib
Retrieve compressed UTF-8 strings from Arduino Flash memory (Progmem)
https://github.com/siara-cc/unishox_arduino_progmem_lib
arduino compression esp32 esp8266 progmem
Last synced: 5 months ago
JSON representation
Retrieve compressed UTF-8 strings from Arduino Flash memory (Progmem)
- Host: GitHub
- URL: https://github.com/siara-cc/unishox_arduino_progmem_lib
- Owner: siara-cc
- License: apache-2.0
- Created: 2019-08-17T19:40:10.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-13T04:58:03.000Z (over 6 years ago)
- Last Synced: 2025-04-30T17:44:38.768Z (8 months ago)
- Topics: arduino, compression, esp32, esp8266, progmem
- Language: C++
- Homepage:
- Size: 230 KB
- Stars: 22
- Watchers: 5
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Compression and decompression Library for use with Arduino Flash Memory (PROGMEM)
[Unishox](https://github.com/siara-cc/Unishox) is a technique used for compressing and decompressing short Unicode strings. This library allows storing of compressed text strings in Arduino Program Memory and provides API to retrieve each string individually using index.
Unishox can achieve upto 60% compression depending on the composition of text. This can be especially useful in constrained environments like Arduino Uno where only 32kb of Flash memory is available.
To find out how Unishox works, read [this article](https://github.com/siara-cc/Unishox/blob/master/Unishox_Article_1.pdf?raw=true).
## Applications
- Displaying descriptive error or warning messages
- Storing UTF-8 file content (such as html)
- Transferring compressed content over low speed networks
## Usage
First, the strings that need to compressed should to be listed in a file (usually with .txt extension).
Download [Unishox](https://github.com/siara-cc/Unishox) and compile it using instructions provided in the repository. Then create compressed PROGMEM header using following command:
```
./unishox1 -g
```
or
```
./unishox -G
```
The command with capital G provides more compression taking into account repeating texts across the file.
For example, if we use the file `Proverbs1.txt` given in the repository and the command `./unishox1 -g Proverbs.txt Proverbs_Uni`, a file by name `proverbs.h` will be generated.
This file can be copied alongside any `.ino` file and included. Then the `Unishox1_pgm_decompress()` API from `unishox_progmem.h` in this library can be called to uncompress the strings.
Please try the examples provided along with this library to see how it works.
## Compatibility
This library can be used with Arduino Duemilanove, Uno upwards. It is useful only if saving by compressing text content is over 3000 bytes since the decompressor takes as much space.
## Limitations
- Unicode (UTF-8) text is compressed well, but binary data (ASCII 0-31, ASCII 128-255) is not compressed well.
## Examples and screenshots
### Proverbs
This example demonstrates de-compression of compressed proverbs from different languages. Source: Wikipedia

## Issues
If you face any problems, please create issue on GitHub.