comparison Implab/Formats/JSON/StringTranslator.cs @ 226:9428ea36838e v2

fixed JSON parser error when parsing escaped double quote symbol
author cin
date Fri, 25 Aug 2017 02:16:35 +0300
parents c32688129f14
children 6fa235c5a760
comparison
equal deleted inserted replaced
225:8222a2ab3ab7 226:9428ea36838e
14 static class StringTranslator { 14 static class StringTranslator {
15 static readonly char[] _escMap; 15 static readonly char[] _escMap;
16 static readonly int[] _hexMap; 16 static readonly int[] _hexMap;
17 17
18 static StringTranslator() { 18 static StringTranslator() {
19 var chars = new char[] { 'b', 'f', 't', 'r', 'n', '\\', '/' }; 19 var chars = new char[] { 'b', 'f', 't', 'r', 'n', '\\', '/', '"' };
20 var vals = new char[] { '\b', '\f', '\t', '\r', '\n', '\\', '/' }; 20 var vals = new char[] { '\b', '\f', '\t', '\r', '\n', '\\', '/', '"' };
21 21
22 _escMap = new char[chars.Max() + 1]; 22 _escMap = new char[chars.Max() + 1];
23 23
24 for (int i = 0; i < chars.Length; i++) 24 for (int i = 0; i < chars.Length; i++)
25 _escMap[chars[i]] = vals[i]; 25 _escMap[chars[i]] = vals[i];