Text, bytes, and Unicode

F-TEXT-V4-2medium

Preview a message

A notification tool counts, previews and size-limits UTF-8 messages.

What needs to change

Repair preview so a long message keeps exactly its first limit code points before the ellipsis.

Reproduce

  1. Compile and run the two-preview sample with g++, then compare both previews with the expected stdout.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

The file contains its headers, the Request struct, readRequests, characters and main. The browser compiles with g++ -std=c++23.

Input: a whole-number limit, one space, then the message.

Messages are valid UTF-8 and limits are nonnegative whole numbers. Characters means code points; no normalization or grapheme-preserving cut is required.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in