Text file guides

Convert UTF-8 Text to Octal Bytes

·

Octal notation describes bytes with digits from 0 to 7. To use it for text, choose a character encoding first. This converter uses UTF-8 and always writes three octal digits per byte.

Octal Text Converter

Follow a three-character string through four bytes

Select Load example and Encode to octal. In whitespace-separated layout, Aé! gives 101 303 251 041. A and the exclamation mark use one byte each. The precomposed é uses two UTF-8 bytes.

Choose Compact three-digit bytes and encode again. The result is 101303251041. Count in groups of three starting at the left. The layout changes the separators and keeps the same four bytes.

RFC 3629, UTF-8 byte sequencesWHATWG Encoding Standard, UTF-8 and fatal decoding

Reopen the saved digits and decode them

Choose Use result as input and then Decode octal, or open the saved file with the matching layout. The result is Aé!. In whitespace-separated layout you can use spaces, tabs or line breaks between complete three-digit groups.

When comparing a UTF-8 source file byte for byte, open the original file before encoding. Pasting through a browser text box can normalize CRLF and CR. The converter preserves the bytes represented by a leading UTF-8 signature and by line-break characters when it reads the file directly.

RFC 3629, UTF-8 byte sequencesWHATWG Encoding Standard, UTF-8 and fatal decoding

Tell an invalid octal group from incomplete UTF-8

Try decoding 400. Its three characters are octal digits, but 400 is above the maximum byte value 377. Try 038 to see an error for a digit outside 0 through 7.

Now decode 303 by itself. It is a valid byte, but it starts a UTF-8 sequence whose next byte is missing. Add 251 in the whitespace-separated layout to recover é.

RFC 3629, UTF-8 byte sequencesWHATWG Encoding Standard, UTF-8 and fatal decoding

Common questions

Can I write 41 instead of 041?

Pad it to 041. Three digits per group keep the byte boundaries clear, including in compact layout.

Will the converter normalize composed and decomposed characters?

It encodes the exact Unicode string. A precomposed é and an e followed by a combining accent can have different byte lists even when they look identical.

Sources

Put it into practice.

Related guides