Please guys, the server returned data of GB18030 and the result of the print request is as follows, can you solve the problem of Chinese becoming random code?
{ “StatusCode”: 200, “Header”: { “Cache-Control”: [ “no-cache” ], “Connection”: [ “Keep-Alive” ], “Content-Type”: [ “application/javascript; charset=GB18030” ] }, “Cookies”: [], “Body”: “var hq_str_gb_$dji=“���˹,34988.8398,1.22,2022-02-16 06:01:05,422.6700,34686.1914,35047.7891,34686.1914,36952.6484,30547.5293,305666649,370199515,0,0.00,–,0.00,0.00,0.00,0.00,0,0,0.0000,0.00,0.0000,Feb 15 05:00PM EST,34566.1719,0,1,2022”;\nvar hq_str_gb_ixic=“��˹��,14139.7573,2.53,2022-02-16 06:30:00,348.8385,13997.1793,14142.4927,13976.2912,16212.2285,12397.0537,3927636514,3859625497,0,0.00,–,0.00,0.00,0.00,0.00,0,0,0.0000,0.00,0.00,Feb 15 05:16PM EST,13790.9188,0,1,2022,0.0000,0.0000,0.0000,0.0000,0.0000”;\nvar hq_str_gb_$inx=“���500ָ��,4471.0698,1.58,2022-02-16 06:01:05,69.4000,4429.2798,4472.7700,4429.2798,4818.6201,3723.3401,2322886082,2633272939,0,0.00,–,0.00,0.00,0.00,0.00,0,0,0.0000,0.00,0.0000,Feb 15 05:00PM EST,4401.6699,0,1,2022”;\nvar hq_str_hf_GC=“1854.430,1854.000,1854.200,1856.500,1851.800,13:20:36,1856.200,1855.500,434039.000,12,14,2022-02-16,ŦԼ��,10348”;\nvar hq_str_hf_CL=“92.017,92.050,92.060,92.560,91.630,13:20:41,92.070,92.210,156766.000,6,1,2022-02-16,WTIŦԼԭ��,19549”;\nvar hq_str_DINIW=“13:20:37,96.0232,96.0232,95.9851,1042,95.9867,96.0705,95.9663,96.0232,��Ԫָ��,2022-02-16”;\nvar hq_str_s_sh000001=“��ָ֤��,3464.4051,18.3166,0.53,1937911,22953814”;\nvar hq_str_rt_hkHSI=“HSI,���ָ��,24618.300,24355.711,24728.930,24548.050,24632.311,276.600,1.140,0.000,0.000,59978587.742,5054267122,0.000,0.000,31183.359,22665.250,2022/02/16,13:20:43,”;\nvar hq_str_b_NKY=“�վ�25ָ��,27468.5000,603.31,2.25,2/15/2022,2022-02-15,2022-02-16,13:18:00,27405.0000,26865.1900,27477.5000,27345.0000,0”;\n” }
Inventors quantify - small dreamsWhen calling the HttpQuery function to send an Http request, specify the character set set in the request header. Try "application/javascript; charset=xxx" set to utf-8, etc.
Inventors quantify - small dreamsThank you for your question.
18599999999I'm not going to say that I'm not.
Inventors quantify - small dreamsWe've upgraded the host for your response to this problem. What's up? function main (() { var ret = HttpQuery and "https://hq.sinajs.cn/rn=1644985273291&list=gb_$dji,gb_ixic,gb_$inx,hf_GC,hf_CL,DINIW,s_sh000001,rt_hkHSI,b_NKY", {method: "GET", charset: "GB18030"}, which is the I'm not sure. "Referer: https://stock.finance.sina.com.cn/usstock/quotes/.IXIC.html", the company said. true What is it? Log (ret.Body) is a file format. I'm not sure. What's up? If you use the latest host, and then use this code to debug, the Chinese characters appear normally.
18599999999Do you think this problem can be solved with code? or can it be solved in a short time?
18599999999The code is available at https://www.fmz.com/strategy/345557
Inventors quantify - small dreamsYou need to look at how your code is written, httpQuery and context.
18599999999I tried to add "Content-Type" in the headers: "application/javascript; charset=utf-8", or not (I don't know if this is correct). I guess the server will only return this character set. And the crawled financial data, changing the request header might also be recognized.