[go: nahoru, domu]

Skip to content
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

Detect Unicode encoding for GSON library #12

Closed
wonderfly opened this issue Jan 9, 2015 · 1 comment
Closed

Detect Unicode encoding for GSON library #12

wonderfly opened this issue Jan 9, 2015 · 1 comment
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@wonderfly
Copy link
Contributor

From yan...@google.com on June 04, 2011 09:12:26

External references, such as a standards document, or specification? http://blog.publicobject.com/2010/08/handling-byte-order-mark-in-java.html copied here (in case that blog goes away):

public Reader inputStreamToReader(InputStream in) throws IOException {
in.mark(3);
int byte1 = in.read();
int byte2 = in.read();
if (byte1 == 0xFF && byte2 == 0xFE) {
return new InputStreamReader(in, "UTF-16LE");
} else if (byte1 == 0xFF && byte2 == 0xFF) {
return new InputStreamReader(in, "UTF-16BE");
} else {
int byte3 = in.read();
if (byte1 == 0xEF && byte2 == 0xBB && byte3 == 0xBF) {
return new InputStreamReader(in, "UTF-8");
} else {
in.reset();
return new InputStreamReader(in);
}
}
} Java environments (e.g. Java 6, Android 2.3, App Engine 1.4.3, or All)? All Please describe the feature requested. Currently the GSON library implementation only supports UTF-8. The algorithm above could potentially be used for supporting the other 3 Unicode encodings supported by the JSON specifications.

Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=12

@wonderfly wonderfly added duplicate type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Jan 9, 2015
@wonderfly wonderfly self-assigned this Jan 9, 2015
@wonderfly
Copy link
Contributor Author

From yan...@google.com on June 08, 2011 14:30:25

Status: Duplicate
Mergedinto: 6

clundin25 pushed a commit to clundin25/google-http-java-client that referenced this issue Aug 11, 2022
Add ServiceAccountJwtHeaderCredentials
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

1 participant