Fit the byte budget
A notification tool counts, previews and size-limits UTF-8 messages.
What needs to change
Repair fit so each message keeps the longest prefix of whole code points within the UTF-8 byte limit.
Reproduce
- Compile and run the two-budget sample with g++, then use Check work for budgets that end inside a character.
Acceptance criteria
Your review marks · Saved in this browser. Test acceptance is tracked separately.
Notes
The file contains its headers, the Request struct, readRequests and main. The browser compiles with g++ -std=c++23.
Input: a byte limit, one space, then the message. main prints size() of the kept string.
Messages are valid UTF-8 and limits are nonnegative whole numbers. Characters means code points; no normalization or grapheme-preserving cut is required.