Avoid method that assume default platform encoding is suitable.#232
Open
arturobernalg wants to merge 1 commit intoapache:masterfrom
Open
Avoid method that assume default platform encoding is suitable.#232arturobernalg wants to merge 1 commit intoapache:masterfrom
arturobernalg wants to merge 1 commit intoapache:masterfrom
Conversation
juanpablo-santos
requested changes
Mar 24, 2023
Contributor
juanpablo-santos
left a comment
There was a problem hiding this comment.
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 ) ); |
Contributor
There was a problem hiding this comment.
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?
Contributor
There was a problem hiding this comment.
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 ) ; |
95ca649 to
0cd3e4b
Compare
24997f4 to
2a910fe
Compare
Member
Author
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.