您需要使用Wireshark分析JSON调用,因此您将看到是否在JSON页面的构成中包含了字符集,例如:
如果页面很简单,如果是text / html
0000 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d HTTP/1.1 200 OK.
0010 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 .Content -Type: t
0020 65 78 74 2f 68 74 6d 6c 0d 0a 43 61 63 68 65 2d ext/html ..Cache-
0030 43 6f 6e 74 72 6f 6c 3a 20 6e 6f 2d 63 61 63 68 Control: no-cach
如果页面的类型包括带有MIME“ charset = ISO-8859-1”的自定义JSON
0000 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d HTTP/1.1 200 OK.
0010 0a 43 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 .Cache-C ontrol:
0020 6e 6f 2d 63 61 63 68 65 0d 0a 43 6f 6e 74 65 6e no-cache ..Conten
0030 74 2d 54 79 70 65 3a 20 74 65 78 74 2f 68 74 6d t-Type: text/htm
0040 6c 3b 20 63 68 61 72 73 65 74 3d 49 53 4f 2d 38 l; chars et=ISO-8
0050 38 35 39 2d 31 0d 0a 43 6f 6e 6e 65 63 74 69 6f 859-1..C onnectio
这是为什么? 因为我们不能在JSON页面上放置这样的目标:
就我而言,我使用制造商Connect Me 9210 Digi:
我必须使用一个标志来指示将使用非标准MIME: p-> theCgiPtr-> = fDataType eRpDataTypeOther;
它将新的MIME添加到变量中: strcpy(p-> theCgiPtr-> fOtherMimeType,“ text / html;charset = ISO-8859-1“);
它为我工作,而不必转换JSON为UTF-8传递的数据,然后在页面上重做转换...