You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the default charset encoding (file.encoding) is not UTF-8, twitterClient.postTweet("あいうえお") results in a tweet whose characters are corrupted.
This is because twittered uses OAuthRequest.setPayload(String), and ScribeJava uses String.getBytes() to obtain the byte array data of the request payload. To fix this issue, twittered should use OAuthRequest.setPayload(byte[]) and pass the result of String.getBytes(StandardCharset.UTF_8) at the code below:
When the default charset encoding (file.encoding) is not UTF-8,
twitterClient.postTweet("あいうえお")
results in a tweet whose characters are corrupted.This is because twittered uses OAuthRequest.setPayload(String), and ScribeJava uses String.getBytes() to obtain the byte array data of the request payload. To fix this issue, twittered should use OAuthRequest.setPayload(byte[]) and pass the result of String.getBytes(StandardCharset.UTF_8) at the code below:
https://github.com/redouane59/twittered/blob/develop/src/main/java/io/github/redouane59/twitter/helpers/AbstractRequestHelper.java#L76
Note: Json should always be encoded in UTF-8 as defined by RFC 8259.
Just for reference, below is the related code sections in ScribeJava:
com.github.scribejava.core.model.OAuthRequest.setPayload(String payload)
https://github.com/scribejava/scribejava/blob/master/scribejava-core/src/main/java/com/github/scribejava/core/model/OAuthRequest.java#L180
com.github.scribejava.core.oauth.OAuthService.execute(OAuthRequest request)
https://github.com/scribejava/scribejava/blob/master/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuthService.java#L108
com.github.scribejava.core.httpclient.jdk.JDKHttpClient.BodyType.setBody(String body)
https://github.com/scribejava/scribejava/blob/master/scribejava-core/src/main/java/com/github/scribejava/core/httpclient/jdk/JDKHttpClient.java#L164
The text was updated successfully, but these errors were encountered: