Skip to content

Commit 9c5e8a5

Browse files
authored
Merge pull request #7 from Learnosity/LRN-14716/bug/unescape-special-chars
Unescaping special chars
2 parents 4d9239a + e717a69 commit 9c5e8a5

File tree

5 files changed

+8
-0
lines changed

5 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v0.14 (2017-04-18)
2+
3+
* Unescape escaped sequences created by JSONObject.toString()
4+
15
## v0.13 (2017-03-13)
26

37
* Replace escaped forward slashes with unescaped forward slashes after stringifying the json object

Dist/All/LearnositySdkJavaAll.jar

463 KB
Binary file not shown.
2.31 KB
Binary file not shown.
469 KB
Binary file not shown.

src/LearnositySdk/Request/Init.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.TimeZone;
1010

1111
import org.apache.commons.codec.digest.DigestUtils;
12+
import org.apache.commons.lang3.StringEscapeUtils;
1213
import org.json.JSONObject;
1314
import org.json.JSONArray;
1415

@@ -391,6 +392,9 @@ private void validateRequestPacket(Object requestPacket) throws Exception
391392

392393
// JSONObject.toString escapes forward slashes. Undo that, in order to avoid changes to the string
393394
this.requestString = this.requestString.replace("\\/", "/");
395+
396+
// unescape any escape sequences created by JSONObject.toString
397+
this.requestString = StringEscapeUtils.unescapeJava(this.requestString);
394398
if (this.requestPacket.length() == 0) {
395399
throw new Exception("The requestPacket cannot be empty.");
396400
}

0 commit comments

Comments
 (0)