Skip to content
Snippets Groups Projects
  • Jean Chalard's avatar
    a411595b
    Fix two nasty bugs with surrogate pairs. · a411595b
    Jean Chalard authored
    The important bug is in findWordInTree. The problem, which is
    not obvious, is that we were calling codePointAt() with the
    code point index in the string, instead of the char index.
    The other bug this change fixes was harmless in the practice,
    because it's in the iteration which is only used for debug and
    pretty printing purposes. It's very similar in that it would
    substract a length in code point to a length in chars and
    truncate a StringBuilder at that length, so it would fail in a
    quite similar manner. This changes the meaning of the "length"
    attribute in Position, but it's clearer this way anyway.
    
    Bug: 8450145
    Change-Id: If396f883a9e6449de39351553ba83f5be5bd30f0
    a411595b
    History
    Fix two nasty bugs with surrogate pairs.
    Jean Chalard authored
    The important bug is in findWordInTree. The problem, which is
    not obvious, is that we were calling codePointAt() with the
    code point index in the string, instead of the char index.
    The other bug this change fixes was harmless in the practice,
    because it's in the iteration which is only used for debug and
    pretty printing purposes. It's very similar in that it would
    substract a length in code point to a length in chars and
    truncate a StringBuilder at that length, so it would fail in a
    quite similar manner. This changes the meaning of the "length"
    attribute in Position, but it's clearer this way anyway.
    
    Bug: 8450145
    Change-Id: If396f883a9e6449de39351553ba83f5be5bd30f0