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

JSONTokener(InputStream) violates rfc8259#section-8.1 (#739) #740

Merged
merged 1 commit into from
May 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main/java/org/json/JSONTokener.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.json;

import java.io.*;
import java.nio.charset.Charset;

/*
Public Domain.
Expand Down Expand Up @@ -56,7 +57,7 @@ public JSONTokener(Reader reader) {
* @param inputStream The source.
*/
public JSONTokener(InputStream inputStream) {
this(new InputStreamReader(inputStream));
this(new InputStreamReader(inputStream, Charset.forName("UTF-8")));
}


Expand Down Expand Up @@ -120,7 +121,7 @@ public static int dehexchar(char c) {

/**
* Checks if the end of the input has been reached.
*
*
* @return true if at the end of the file and we didn't step back
*/
public boolean end() {
Expand Down Expand Up @@ -184,7 +185,7 @@ public char next() throws JSONException {
this.previous = (char) c;
return this.previous;
}

/**
* Get the last character read from the input or '\0' if nothing has been read yet.
* @return the last character read from the input.
Expand Down