Actions
Bug #21101
closedEncoding::CompatibilityError when using String#strip
Description
When opening an ISO 8859-1 encoded file containing a German letter (e.g. ö), then parsing through each line and stripping whitespace using either rstrip
or strip
it raises an Error ( lstrip
seams fine; I'd assume it skips stripping when there isn't any whitespace in front of the string).
File.open('test.dat').each_line { |line| line.strip } # raises Encoding::CompatibilityError
I've tried this with multiple ruby versions.
It was working as expected in these versions:
- 2.7.8
- 3.0.0
- 3.0.7
- 3.1.0
- 3.1.1
- 3.1.2
- 3.1.3
- 3.1.4
- 3.1.5
- 3.1.6
And it didn't work in these:
- 3.2.0
- 3.2.1
- 3.2.2
- 3.2.3
- 3.2.4
- 3.2.5
- 3.2.6
- 3.3.6
- 3.3.7
I didn't find anything in the Patch notes of ruby 3.2.0 about the changed behavior.
Did I miss something?
Files
Actions
Like0
Like0Like0Like0Like0