Ask an expert: How to solve the problem of garbled downloading data from this website?I downloaded the data from this website according to the following script, and the result was garbled.
Although I have added the language code.
Thanks!
u="http://basic.10jqka.com.cn/600000/equity.html";d1=Open(u,HTML Table(3,Column Names(1),Data Starts(2)),Charset("gb2312"));


ScriptingRe: 请教专家:怎样解决下载这个网站数据的乱码问题?try something like this
u="https://www.w3schools.com/html/html_tables.asp";
blobdata = loadtextfile(u,blob);
//blobdata=blobpeek(blobdata,0,47939)||hextoblob("20CDE2")||blobpeek(blobdata,47939);// insert 外 https://en.wikipedia.org/wiki/GB_2312
chardata = blobtochar(blobdata,"gb2312");
filename = savetextfile("$temp/deleteme.html",chardata);
d1=Open(filename,HTML Table(1));
Download the data as a blob.
Convert the blob to character data using the GB2312 encoding.
Save the character data; it will be UTF8 encoding on disk.
Open the saved file.
the blobpeek offset was chosen very carefully to but the character here.
Re: Ask an expert: How to solve the problem of garbled downloading data from this website?Thanks experts!
I tried to follow the modification, but I can’t download it like this

Re: 请教专家:怎样解决下载这个网站数据的乱码问题?u="http://basic.10jqka.com.cn/600000/equity.html";
txt = loadtextfile(u,blob);<BR />
它不工作。谢谢!
Re: 请教专家:怎样解决下载这个网站数据的乱码问题?There might be a translation problem.
I think you are saying it did not work.
I am guessing it needs a user name and password.
If I am wrong, you'll need to give me more information.
Here's how you can supply a basic auth password.
You might need to use https instead of http.
//u = "http://basic.10jqka.com.cn/600000/equity.html";
u = "https://www.w3schools.com/html/html_tables.asp";
blobdata = New HTTP Request(
URL( u ),
Method( "GET" ),
Username( "ross" ),
Password( "Abc123" )
) << Send( "blob" );
chardata = Blob To Char( blobdata, "gb2312" );
filename = Save Text File( "$temp/deleteme.html", chardata );
d1 = Open( filename, HTML Table( 1 ) );
Re: Ask an expert: How to solve the problem of garbled downloading data from this website?Thanks for the help of the experts!
This website is a free website that does not require login.
I will take a screenshot of its "webpage source code"


Re: Ask an expert: How to solve the problem of garbled downloading data from this website?The strange thing is that this website is garbled when viewed in F12 in Chrome

Re: Ask an expert: How to solve the problem of garbled downloading data from this website?I hope that the English letters in my post can also be translated correctly.
Thanks to the experts in the community!
Re: Ask the experts: How to solve the problem of garbled downloading data from this website?In fact, Craige_Hales has already given the answer. On his basis, it can be slightly modified as follows.
Actually, Craige_Hales has already worked it out. The followed code based on his work.
u="http://basic.10jqka.com.cn/600000/equity.html";
blobdata = loadtextfile(u,blob);
chardata = blobtochar(blobdata,"gb2312");
filename = savetextfile("$temp/deleteme.html",chardata);
d1=Open(filename,HTML Table(3));
In addition, you can also choose to import from the internet when importing, open the way to select the web page, and then select the data table that needs to be exported, and it can also be displayed normally.
Besides, Selecting File > Internet Open> Web Page could do this too, just set Open As to Web Page instead of Data.

Re: 请教专家:怎样解决下载这个网站数据的乱码问题?I'm not sure.
Part of the time I get "forbidden" as a result (missing cookie, and maybe missing user-agent might be how the server decides to forbid access.)
I think the web site may be checking to see if an interactive browser with JavaScript enabled is in use.
JMP does not run JavaScript on web pages.
You might want to (1) check for their acceptable use policy, (2) see if they have a rest api for accessing the data.
Screen-scraping this site will be hard to maintain.