-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
validate support single quote, for issue #2059
- Loading branch information
Showing
4 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4313,6 +4313,7 @@ public final void skipValue() { | |
} | ||
break; | ||
} | ||
case '\'': | ||
case '"': { | ||
skipString(); | ||
break; | ||
|
This file contains 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
30 changes: 30 additions & 0 deletions
30
core/src/test/java/com/alibaba/fastjson2/issues_2000/Issue2059.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.alibaba.fastjson2.issues_2000; | ||
|
||
import com.alibaba.fastjson2.JSON; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class Issue2059 { | ||
@Test | ||
public void test() { | ||
String str1 = "{'queryParam':{ 'STATUS': '1','MENU_TYPE': '11'}}"; | ||
assertTrue( | ||
JSON.isValid(str1)); | ||
assertTrue( | ||
JSON.isValid(str1.toCharArray())); | ||
assertTrue( | ||
JSON.isValid( | ||
str1.getBytes(StandardCharsets.UTF_8))); | ||
assertTrue( | ||
JSON.isValid( | ||
str1.getBytes(StandardCharsets.UTF_8), | ||
StandardCharsets.ISO_8859_1)); | ||
assertTrue( | ||
JSON.isValid( | ||
str1.getBytes(StandardCharsets.UTF_8), | ||
StandardCharsets.US_ASCII)); | ||
} | ||
} |