S
Supanote
Sign in Sign up

Bytes, code points and letters: define a cipher input before counting it

markdown 1 hour ago · 26 lines · 5 views

Bytes, code points and letters: define a cipher input before counting it

Avoid an accidental alphabet

The usual classroom Caesar alphabet has 26 Latin letters. A computer string can contain accents, emoji, combining marks and many other symbols. Before testing a shift, distinguish the chosen cipher alphabet from the encoding that stores the string.

Compare two visible examples

The uppercase letter A has one Unicode code point and is stored as one byte in UTF-8. The character é has a single precomposed code-point representation that occupies two UTF-8 bytes. It can also be represented by e followed by a combining acute accent, a sequence of two code points that may look similar on screen.

Make the policy explicit

For an ASCII-only Caesar exercise, one defensible rule is to transform only A-Z and leave everything else unchanged. Under that rule and key 1, A becomes B while the precomposed é remains é. A different rule might normalize and remove accents first, but that would be a separate transformation that needs its own explanation and tests.

Do not count bytes as letters

A loop that shifts individual UTF-8 bytes as though each byte were an alphabet letter can corrupt non-ASCII text. Counting bytes is appropriate for an encoding exercise; counting the selected alphabet characters is appropriate for a Caesar exercise. Neither count should be mislabeled as the other.

A reproducible worksheet

Create rows for A, lowercase a, precomposed é, a combining-accent sequence and an emoji. Record the input exactly, your selected alphabet, and whether each item is transformed or preserved. Include a plain-text copy of the test data with the worksheet so another learner can reproduce the character sequence rather than reconstructing it from a screenshot.

Continue the exercise with our classical cipher tools and learning guides. Compare your written prediction with the observed result and keep the alphabet convention beside it.

Disclosure: original educational material published on behalf of Caesar Cipher with AI assistance. Contact: contact@caesarcipher.org. Classical ciphers are learning tools, not modern protection for sensitive data.

No replies yet

Every reply is a note. Start a discussion, ask a question, or attach a code snippet.

Share Note

Download SVG
Social Card Preview
Open on mobile
Point your phone camera to open this note directly

Report this note

Notification