-
Notifications
You must be signed in to change notification settings - Fork 102
Avoid method that assume default platform encoding is suitable. #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
juanpablo-santos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes requested
|
|
||
| try( final BufferedReader stdout = new BufferedReader( new InputStreamReader( process.getInputStream() ) ); | ||
| final BufferedReader stderr = new BufferedReader( new InputStreamReader( process.getErrorStream() ) ) ) { | ||
| try( final BufferedReader stdout = new BufferedReader( new InputStreamReader( process.getInputStream(), StandardCharsets.UTF_8 ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only method using this one is expecting it to be on ISO-8859. Perhaps passing as an argument engine.getContentEncoding() and use it, ensuring it's used throughout the entire call, would be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
honestly it should probably all be standardized on utf8. is there a reason for this specific setup to use (basically) ascii? we have a ton of internationalization code within jspwiki, this just seems a bit off
| // Transform to Base64-encoded String | ||
| final byte[] result = Base64.getEncoder().encode( bytesOut.toByteArray() ); | ||
| return new String( result ) ; | ||
| return new String( result, StandardCharsets.UTF_8 ) ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
95ca649 to
0cd3e4b
Compare
24997f4 to
2a910fe
Compare
|
I've made changes to avoid reliance on default platform encoding, I think this would be a nice addition to the 2.12.2 release. Please take a look. Best, |
2a910fe to
84d5893
Compare
Dm: Reliance on default encoding (DM_DEFAULT_ENCODING)
Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behavior to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.