How to get Chinese webpage content?

zhaozj2021-02-16  47

Imports System.Netimports System.io

(1)

??????? Dim Req as WebRequest = WebRequest.create ("http://mydotnet.go.nease.net") ??????? Dim Resp AS WebResponse = Req.getResponse () ??? ???? DIM S as stream = Resp.getResponsestream () ??????? Dim SR AS streamreader = new streamreader (s, system.text.encoding.default) ??????? Dim Str As String = sr.readToend () ??????? textbox1.text = STR

(2)

??????? Dim Req as WebRequest = WebRequest.create ("http://blog.9cbs.net/angintz") ??????? Dim Resp AS WebResponse = Req.getResponse () ??? ???? DIM S as stream = Resp.getResponseSstream () ??????? Dim SR AS streamreader = new streamreader (s, system.text.encoding.utf8) ??????? Dim Str As string = sr.readToend () ??????? textbox1.text = STR

If there is Chinese in the web, different web pages should be used to obtain Chinese correctly.

Simple comparison of several web pages, found that if there is a charset = GB2312:

Charset = GB2312 ">

Use system.text.Encoding.default to display correctly

If you don't have a CHARSET = GB2312 inside Meta, you can display Chinese correctly with system.text.encoding.utf8.

I don't know if this is regular?

转载请注明原文地址:https://www.9cbs.com/read-19973.html

New Post(0)