Skip to content

Commit

Permalink
Merge pull request #477 from vkay94/fix-comments-parsing
Browse files Browse the repository at this point in the history
Fix comments parsing
  • Loading branch information
TobiGr authored Dec 9, 2020
2 parents 8ade913 + 9dbacbc commit 6fbcdd2
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,15 @@ private String getDataString(Map<String, String> params) throws UnsupportedEncod
}

private String findValue(String doc, String start, String end) {
final int beginIndex = doc.indexOf(start) + start.length();
final int endIndex = doc.indexOf(end, beginIndex);
return doc.substring(beginIndex, endIndex);
final String unescaped = doc
.replaceAll("\\\\x22", "\"")
.replaceAll("\\\\x7b", "{")
.replaceAll("\\\\x7d", "}")
.replaceAll("\\\\x5b", "[")
.replaceAll("\\\\x5d", "]");

final int beginIndex = unescaped.indexOf(start) + start.length();
final int endIndex = unescaped.indexOf(end, beginIndex);
return unescaped.substring(beginIndex, endIndex);
}
}

0 comments on commit 6fbcdd2

Please sign in to comment.