I just ran across unintuitive behavior in String.strip
When the last U8 preceding the trailing whitespace is a fragment of a utf-8 sequence,
it gets chopped off along with the following whitespace.
Whe the last U8 preceding the end of the string is a fragment of a utf-8 sequence,
that last codepoint gets mangled to its first octet.
This goes against the prinicple of least surprise. Encoding issues notwithstanding,
I think a programmer is justified in expecting String.strip()
to not modify a string that contains
no whitespace.
I've added test cases to the builtin_test/_test.pony
suite, and I'm trying to understand
how String.rstrip()
works, to try and propose a solution.