English 中文(简体)
用多种语文网站收集不同语文的超文本数据
原标题:Fetching different language s HTML data from multilingual website

有一个<>多语文<>网站。 当我从浏览器看到html来源时,我用我的语言看到数据。 但是,当我创设一个斜体和超文本时,我获得英文数据。

  • In my browser, lang attribute is: lang="tr" xml:lang="tr"
  • When I fetch the HTML it is: lang="en" xml:lang="en"

我想用土耳其语排出超文本。 我如何能够这样做?


这就是我如何看待:

        WebRequest request = WebRequest.Create(webUrl);
        request.Method = "POST";
        byte[] byteArray = Encoding.UTF8.GetBytes("");
        request.ContentType = "application/x-www-form-urlencoded";
        request.ContentLength = byteArray.Length;

        Stream dataStream = request.GetRequestStream();
        dataStream.Write(byteArray, 0, byteArray.Length);
        dataStream.Close();

        WebResponse response = request.GetResponse();
        dataStream = response.GetResponseStream();

        StreamReader reader = new StreamReader(dataStream);
        htmlcontent = reader.ReadToEnd();

        reader.Close();
        dataStream.Close();
        response.Close();

提前感谢。

最佳回答

http://www.w3.org/ protocols/rfc2616/rfc2616-sec14.html” rel=“nofollow”Accept-Language。 http://msdn.microsoft.com/en-us/library/yfb6df 4228v=vs.100%29.aspx”rel=“nofollow”HttpRequestHeader.ContentLanguage> 类似:

request.Headers[HttpRequestHeader.AcceptLanguage] = 
                                         "tr-TR,tr;q=0.8,en-US;q=0.6,en;q=0.4";
问题回答
WebHeaderCollection headerCollection = request.Headers;    
headerCollection.Add("Accept-Language:tr");

在您的网站上添加一个标题:

 Accept-Language: tk

这将告诉伙伴关系。 联系你喜欢的语言。 你们必须履行语言转换功能。 MSDN有一个网页: here.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签