‹ BackHN Continuity

Thread

UTF-8000: Unlimited UTF-8

134 points · 122 comments · vismit2000

  1. 2shortplanks · · focus · HN ↗
    On a practical matter, it seems like a bad idea to have codepoints that can take up to an arbitrary number of bytes - this just screams buffer overflow problems.

    So in practicality, you’re going to want an arbitrary limit on this (the article suggests as much). But if you place a limit on it then you’ve got one implementation of the standard that can decode certain characters and another that can’t. Better to have one standard that puts a hard limit on the number of bytes and another standard that uses more bytes and so on.

    1. flohofwoe · · focus · HN ↗
      OTH UTF-8 is just one variable-length stream encoding among many others (RLE, LBE128, etc...).
      1. saghm · · focus · HN ↗
        Unless I'm misremembering, even UTF-16 is variable. You need to bump up to UTF-32 to get fixed-width.
        1. mafuy · · focus · HN ↗
          Correct me if I'm wrong, but I think all kinds of UTF, including 16 and 32, support arbitrary length for a single effective character. This would be because you can stack modifications as long as you like.
          1. ElectricalUnion · · focus · HN ↗
            What you meant by "single effective character" is grapheme clusters. This whole discussion is about variable sized code points.
            1. Dylan16807 · · focus · HN ↗
              The first comment was kind of iffy when it was also talking about buffers and characters, and focusing on code points is mostly a bad focus. It's worth bringing up so nobody thinks fixed width at a single layer is particularly useful, because other layers will still be variable.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.