Fix eRT decoding: resize buffer to 128 bytes, add UTF-8 validation#152
Fix eRT decoding: resize buffer to 128 bytes, add UTF-8 validation#152windytan merged 3 commits intowindytan:masterfrom
Conversation
VasylSamoilov
commented
Jan 3, 2026
- Resize eRT buffer from 64 to 128 bytes per IEC 62106-6, fixes eRT buffer not sized for 128 bytes #149
- Add sanitizeUtf8() to handle incomplete multi-byte sequences, fixes No UTF-8 validation before JSON output #150
- Fix off-by-one in RT+/eRT+ tag extraction at string end, fixes RT+/eRT+ tag extraction off-by-one #151
|
Thanks a lot! Is there any way you could record, in the hexadecimal format, a short snippet of a radio station that transmits such eRT that exhibits the bug? I could then add it to the component or e2e tests. As I don't have eRT stations available locally for testing. |
- Resize eRT buffer from 64 to 128 bytes per IEC 62106-6 - Add sanitizeUtf8() to handle incomplete multi-byte sequences - Fix off-by-one in RT+/eRT+ tag extraction at string end - Fix eRT+ tag extraction failure with UTF-8 characters
|
I just squashed and pushed new fix.
|
|
Hi. Glad it helped. It's not a radio station as in commercial radio station, I'm writing RDS encoder/decoder based on osmocom-analog radio module, using your decoder as reference decoder. As I'm throwing in different (often invalid) data into redsea, a nice special effects pop up here and there. For this specific case I read iec-62106-6-2018 multiple times to understand what is going on and where we should count bytes, and where we should count characters. Test that caused all the problems was: |
|
If this helps, here is the hex string. I can also capture whatever I'm transmitting with redsea and provide dump, if needed. |
|
PE5PVB's TEF6686_ESP32 https://github.com/PE5PVB/TEF6686_ESP32 based receiver aligns well with the proposed format. The successful decoding of eRT (including eRT+ tags) and proper on-screen display using encoding that match the fixes provided is pretty good validation (the best we can have so far). |
|
Ok thanks, really nice testing |
|
Hi, added just one comment, otherwise I think it's good to merge. I might add tests at a later commit. |
|
This commit is mainly meant to illustrate the issue, not to be a final or optimal solution. I addressed your comments and added unit tests as best I could. Please feel free to adjust or improve the implementation if you see any issues. |