Closed dbwiddis closed 10 months ago
FYI, I removed the offending character in my own project in the interest of portability, however, I still would like to handle this edge case here.
Happy to submit a PR. WDYT about adding a <configuration>
option to specify an output charset? It would default to the JDK's default charset but would permit users to override that in the above code block, for example to ISO-8859-1.
Happy to submit a PR. WDYT about adding a
option to specify an output charset? It would default to the JDK's default charset but would permit users to override that in the above code block, for example to ISO-8859-1.
Sure, sounds like a good fallback solution for such cases.
Coming from https://github.com/oshi/oshi/pull/2525#issuecomment-1838992663
LANG=C.UTF-8
.Full log: https://github.com/oshi/oshi/actions/runs/7089320523/job/19293798675 Excerpt:
The code involved (exception thrown in
Files.lines()
Since this is pre-JDK 18, the fix for #95 using the "native.encoding" doesn't apply, however, the symptom is the same. The charset being used doesn't understand one of the characters being processed.
This Stack Overflow answer suggests trying multiple charsets. Another answer claims
Not sure if this is something you want to handle here, but at a minimum I'd request that you at least catch the exception and provide a better error message indicating that the default charset (print it out) can't handle a line of output.