matterbridge icon indicating copy to clipboard operation
matterbridge copied to clipboard

Correctly split three-or-more byte sequences of UTF-8

Open BenWiederhake opened this issue 11 months ago • 1 comments

The underlying bug was the assumption that uft8.DecodeLastRuneInString returns some kind of number of bytes that, when stripped from the end, leaves the string with a correct ending.

In reality, this function always returns the constant value 1 if the last rune is not valid.

Therefore, if there are two or more partial bytes of a three-or-more byte rune, this used to give the wrong result.

Found while trying to implement a related feature.

BenWiederhake avatar Mar 07 '24 21:03 BenWiederhake

Code Climate has analyzed commit d9c1df73 and detected 0 issues on this pull request.

View more on Code Climate.

codeclimate[bot] avatar Mar 07 '24 21:03 codeclimate[bot]

Thanks 👍

42wim avatar May 23 '24 22:05 42wim