Copilot commented on code in PR #2585:
URL: https://github.com/apache/groovy/pull/2585#discussion_r3380024871
##########
subprojects/groovy-csv/src/main/java/groovy/csv/CsvSlurper.java:
##########
@@ -155,7 +156,7 @@ public List<Map<String, String>> parse(Reader reader) {
* @return a list of maps (one per row)
*/
public List<Map<String, String>> parse(InputStream stream) {
- return parse(new InputStreamReader(stream));
+ return parse(new InputStreamReader(stream, StandardCharsets.UTF_8));
}
Review Comment:
This change fixes charset handling for InputStream/Path parsing, but there’s
no regression test that would fail under a non-UTF-8 default charset (e.g.,
Windows). Consider adding a test that parses UTF-8 bytes containing a non-ASCII
character (e.g., 'café') via the InputStream and Path overloads and asserts the
character round-trips correctly.
##########
subprojects/groovy-toml/src/main/java/groovy/toml/TomlSlurper.java:
##########
@@ -78,7 +79,7 @@ public Object parse(Reader reader) {
* @return the root node of the parsed tree of Nodes
*/
public Object parse(InputStream stream) {
- return parse(new InputStreamReader(stream));
+ return parse(new InputStreamReader(stream, StandardCharsets.UTF_8));
}
Review Comment:
This change fixes charset handling for InputStream/Path parsing, but there’s
no regression test that would fail under a non-UTF-8 default charset (e.g.,
Windows). Consider adding a spec test that parses UTF-8 bytes containing a
non-ASCII character (e.g., 'café' encoded as 0x63 0x61 0x66 0xC3 0xA9) via the
InputStream/Path overloads and asserts the character round-trips correctly.
##########
subprojects/groovy-yaml/src/main/java/groovy/yaml/YamlSlurper.java:
##########
@@ -77,7 +78,7 @@ public Object parse(Reader reader) {
* @return the root node of the parsed tree of Nodes
*/
public Object parse(InputStream stream) {
- return parse(new InputStreamReader(stream));
+ return parse(new InputStreamReader(stream, StandardCharsets.UTF_8));
}
Review Comment:
This change fixes charset handling for InputStream/Path parsing, but there’s
no regression test that would fail under a non-UTF-8 default charset (e.g.,
Windows). Consider adding a spec test that parses UTF-8 bytes containing a
non-ASCII character (e.g., 'café' encoded as 0x63 0x61 0x66 0xC3 0xA9) via the
InputStream/Path overloads and asserts the character round-trips correctly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]