Feature Proposal: Auto-splitting for long messages, Byte-accurate counter, and Live Transliteration #112

Open
opened 2026-10-27 13:43:00 +01:00 by adam · 1 comment
Owner

Description:
Hello! First of all, thank you for the amazing Contact client. While using it actively with Cyrillic characters, I encountered frequent Data payload too big errors and node disconnects because UTF-8 characters take 2 bytes, easily overflowing the ~220-byte Meshtastic payload limit.

To fix this, I implemented several QoL improvements in my local build that I believe would greatly benefit the community. I would love to contribute these ideas (or the code itself) if you find them valuable:

  1. Byte-Accurate Counter & Auto-Chunking

    The Issue: The default character counter doesn't reflect the actual byte size of UTF-8 strings.

    The Fix: Changed the counter to calculate len(draft.encode('utf-8')). If a message exceeds the safe limit (e.g., 220 bytes), the script automatically splits it into chunks, appending 1/N, 2/N to the end of each part.

    Anti-Spam Delay: Added a time.sleep(2.5) delay between sending automated chunks to prevent radio buffer overflows and disconnects.

  2. Live Transliteration Toggle (F6)

    The Issue: Cyrillic (and other non-Latin) messages consume double the bandwidth.

    The Fix: Added a real-time transliteration feature. Pressing F6 toggles a new curses preview window right above the input field, showing the transliterated text and its reduced byte size. When hitting Enter, the transliterated version is sent automatically.

    Customizable: The mapping dictionary is stored in config.json so users can edit the replacement rules directly.

  3. Robust Config Handling

    Added a fallback try/except block in default_config.py to catch JSONDecodeError. If a user manually edits config.json and breaks the syntax (e.g., misses a quote), the app auto-heals and recreates the default config instead of crashing on startup.

These changes make the client much more stable for international users and prevent hardware disconnects caused by oversized payloads. Let me know if you would be interested in a Pull Request for these features!

Description: Hello! First of all, thank you for the amazing Contact client. While using it actively with Cyrillic characters, I encountered frequent Data payload too big errors and node disconnects because UTF-8 characters take 2 bytes, easily overflowing the ~220-byte Meshtastic payload limit. To fix this, I implemented several QoL improvements in my local build that I believe would greatly benefit the community. I would love to contribute these ideas (or the code itself) if you find them valuable: 1. Byte-Accurate Counter & Auto-Chunking The Issue: The default character counter doesn't reflect the actual byte size of UTF-8 strings. The Fix: Changed the counter to calculate len(draft.encode('utf-8')). If a message exceeds the safe limit (e.g., 220 bytes), the script automatically splits it into chunks, appending 1/N, 2/N to the end of each part. Anti-Spam Delay: Added a time.sleep(2.5) delay between sending automated chunks to prevent radio buffer overflows and disconnects. 2. Live Transliteration Toggle (F6) The Issue: Cyrillic (and other non-Latin) messages consume double the bandwidth. The Fix: Added a real-time transliteration feature. Pressing F6 toggles a new curses preview window right above the input field, showing the transliterated text and its reduced byte size. When hitting Enter, the transliterated version is sent automatically. Customizable: The mapping dictionary is stored in config.json so users can edit the replacement rules directly. 3. Robust Config Handling Added a fallback try/except block in default_config.py to catch JSONDecodeError. If a user manually edits config.json and breaks the syntax (e.g., misses a quote), the app auto-heals and recreates the default config instead of crashing on startup. These changes make the client much more stable for international users and prevent hardware disconnects caused by oversized payloads. Let me know if you would be interested in a Pull Request for these features! <!-- github-sync-id:5926092786 -->
Author
Owner

I like it, a PR would be welcome.

on point 3, I wouldn't want the misconfigured config to be overwritten, in case the user wants to recover it. Perhaps we could have a default fallback with a warning that the user config has a formatting error?

I like it, a PR would be welcome. on point 3, I wouldn't want the misconfigured config to be overwritten, in case the user wants to recover it. Perhaps we could have a default fallback with a warning that the user config has a formatting error? <!-- github-comment-id:6275531965 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/contact#112