2
\$\begingroup\$

U+007F, though it is not a C0 control character, Unicode still considers it as a control character. It is the deleted character.

If one mis-punched a character into a punched tape, one would turn it to the deleted character by punching all 7 holes. An interpreter for punched tapes would skip all deleted characters. ASCII followed this convention and thus assigned 0x7F the deleted character. And Unicode followed ASCII.

Following this convention, it would mean one must skip all U+007F. Does this mean U+007F doesn't contribute to a byte count at all?

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ Is there a modern interpreter that interprets 0x7F as ignore this character? \$\endgroup\$ – Jo King Sep 1 at 6:09
  • \$\begingroup\$ @JoKing I don't know. \$\endgroup\$ – Dannyu NDos Sep 1 at 6:36
  • \$\begingroup\$ Then the premise one must skip all U+007F is false and therefore the answer to your last question is no. \$\endgroup\$ – Jo King Sep 1 at 7:50
19
\$\begingroup\$

It counts as one byte in ASCII, UTF-8, and any language-specific SBCS

Regardless of how the character was treated in the history, 0x7F is a perfectly valid byte value to appear in a source code file. And when we score bytes, we are essentially counting the number of bytes in the source code file. Therefore, the character 0x7F should be counted as one byte like any other byte value.

Otherwise every single code-golf challenge would have Lenguage, 0 bytes.

| |
\$\endgroup\$
  • \$\begingroup\$ I think the only time this wouldn't apply is if there was some language where the deleted character was used for its actual purpose, and ignored. But then you'd just remove it before posting. \$\endgroup\$ – Redwolf Programs Sep 4 at 14:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .