‹ BackHN Continuity

Thread

UTF-8000: Unlimited UTF-8

134 points · 122 comments · vismit2000

  1. Dwedit · · focus · HN ↗
    FF bytes are an easy way to identify an invalid UTF-8 file. This idea doesn't have that property.
    1. sph · · focus · HN ↗
      True, but not all non-UTF8 bytestrings contain 0xFF bytes, so it’s not very useful in practice.
      1. da_chicken · · focus · HN ↗
        Yes, I agree.

        It's more common for programs that say they support UTF-8 to not really do so at all. It wasn't that long ago that "UTF-8" support was often just single byte, so it was little more than ASCII. Even now it's common for programs to choke on the optional BOM. Yes, it is redundant, congratulations. The spec still explicitly allows it. Three and four byte character support is still not the best, too.

        1. flohofwoe · · focus · HN ↗
          > "UTF-8" support was often just single byte, so it was little more than ASCII

          "Single byte UTF-8" is ASCII. That's one of its most important properties.

          > Even now it's common for programs to choke on the optional BOM

          And they should... BOMs (and especially the hilarious UTF-8 BOM) are strictly a legacy Microsoft/Windows thing and should be abolished along with "extended" 8-bit ASCII encodings and UCS-2/UTF-16 (only UTF-32 makes sense, but should only be used at runtime to allow random access on UNICODE code points, but not for data exchange.

          1. Dwedit · · focus · HN ↗
            CJK characters is the one big weak point of UTF-8. It forces them to be 3 bytes large instead of the local codepage which is 2 bytes per character, or UTF-16 which is also 2 bytes per character.
            1. flohofwoe · · focus · HN ↗
              IMHO a 30 percent size increase for sharing text data is really not a problem when most data sharing (by volume) happens via audio, video and image data which is infinitely larger. We obviously have both the bandwidth and storage volume to spare for those 30% increased size for text data which among all the other data would account for a tiny fraction of a percent.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.