• Treeniks
    link
    fedilink
    4
    edit-2
    1 year ago

    The way UTF-8 works is fixed though, isn’t it? A new Unicode standard should not change that, so as long as the string is UTF-8 encoded, you can determine the character count without needing to have the latest Unicode standard.

    Plus in Rust, you can instead use .chars().count() as Rust’s char type is UTF-8 Unicode encoded, thus strings are as well.

    turns out one should read the article before commenting

    • @[email protected]
      link
      fedilink
      61 year ago

      No offense, but did you read the article?

      You should at least read the section “Wouldn’t UTF-32 be easier for everything?” and the following two sections for the context here.

      So, everything you’ve said is correct, but it’s irrelevant for the grapheme count.
      And you should pretty much never need to know the number of codepoints.

      • Treeniks
        link
        fedilink
        31 year ago

        yup, my bad. Frankly I thought grapheme meant something else, rather stupid of me. I think I understand the issue now and agree with you.

        • @[email protected]
          link
          fedilink
          31 year ago

          No worries, I almost commented here without reading the article, too, and did not really know what graphemes are beforehand either. 🫠

    • @[email protected]
      link
      fedilink
      21 year ago

      Nope, the article says that what is and is not a grapheme cluster changes between unicode versions each year :)