Characters and stored bytes

A text export tool offers UTF-8 and UTF-16. The encoded size of a string is the number of bytes produced by its character encoding.


Use these rules for the strings in the table:

  • Each ordinary Latin letter occupies 1 byte in UTF-8.
  • The character é occupies 2 bytes in UTF-8.
  • The character 水 occupies 3 bytes in UTF-8.
  • Every character shown occupies 2 bytes in UTF-16.

Treat é as one stored character, and count each displayed character once. Include only the encoded text: there are no headers, terminators, or other additional bytes. Enter exact integers in every blank.

TextCharacter countUTF-8 size (bytes)UTF-16 size (bytes)
Lab
café
水A

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Data Formats and Internal Representations Questions: