Each Unicode codepoint can be represented as a sequence of up to 4 bytes. Because of this, it is possible to interpret some 2, 3, or 4-byte characters as multiple 1-byte characters. (See here for a UTF-8 to bytes converter).


Given a UTF-8 character, output it split into a sequence of 1-byte characters. If the character is 1-byte already, return it unchanged.

  • Your program must take one, and exactly one, UTF-8 character as input. You may use any input method you wish, as long as it has been decided on meta that is is a valid method. You cannot take input as a bytearray or series of bytes; then the challenge would just be converting hex to ASCII.
  • Your program must output one or more ASCII 1-byte characters. Again, any output method is allowed as long as it has been marked valid on meta. Edit: As per the conversation in the comments, output should be in Code Page 850.

Note: see this post for valid I/O methods.

Example I/O

܀ (0x700)
܀ (0xdc 0x80)

a (0x61)
a (0x61)

聂 (0x8042)
Þüé (0xe8 0x81 0x82)


This is , so shortest answer in bytes wins!

  • 6
    \$\begingroup\$ It looks like the hex values in the output examples map to the hex byte values of the split input, but I don't know where the actual output characters are coming from. I checked extended ASCII, UTF-8, UTF-16, Unicode... \$\endgroup\$
    – Malivil
    Nov 25, 2019 at 1:23
  • 3
    \$\begingroup\$ Can we input as a byte array (obviously allowed input method for a string) and output as a byte array (obviously allowed output method for a string)? :) \$\endgroup\$ Nov 25, 2019 at 1:57
  • 5
    \$\begingroup\$ @JoKing Hmmm - "Your program must take one, and exactly one, UTF-8 character as input" - if we can take that as bytes then this is just "convert to chars", and if we can output those chars as bytes it's a no-op :/ \$\endgroup\$ Nov 25, 2019 at 2:22
  • 2
    \$\begingroup\$ @JoKing Do you mean Code page 437? \$\endgroup\$
    – tsh
    Nov 25, 2019 at 9:00
  • 3
    \$\begingroup\$ I'm guessing that you're asking us to take a Unicode codepoint as a number and output its UTF-8 representation as a sequence of bytes, but that's only a guess. Is that right? \$\endgroup\$ Nov 25, 2019 at 15:32

1 Answer 1


C# (Visual C# Interactive Compiler), 73 85 bytes


Try it online!

+12 bytes to use the updated code page


Not the answer you're looking for? Browse other questions tagged or ask your own question.