举个例子,大家看下地址:
http://www.me-web.jp/shopbrand/012/P/是日本一个网站,我想把相关信息采集下来,然后把部分信息用正则获取出来,但是用HttpWebRequest和HttpWebResponse获取时,显示的是乱码,日语乱码,在ie中自动选择显示正常,但一查看源代码,源代码里显示的也是日文乱码,而用c#获取也是,用php获取也是,但在solaris 上获取的源代码就不是了,能正常显示,且HttpWebResponse的Encoding.GetCo...等都试过,解决不了问题,直郁闷,各位大哥帮帮啊!

解决方案 »

  1.   

    HttpWebRequest设置请求数据的编码不行吗
      

  2.   

    HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
    HttpWebResponse res = (HttpWebResponse)req.GetResponse();
    Stream str = res.GetResponseStream();
    StreamReader sr = new StreamReader(str,Encoding.Default);
    rchText.AppendText(sr.ReadToEnd());
    sr.Close();
    str.Close();
    res.Close();utf8,EUC-JP,Shift_Jis,Default都试过了,没有一个行的。还是乱码:
    HEADメニュ〖 谢谢!大哥,帮下.
      

  3.   


                WebClient wc = new WebClient();
                Stream stream = wc.OpenRead("http://www.me-web.jp/shopbrand/012/P/");
                StreamReader sr = new StreamReader(stream, Encoding.Default);
                Console.WriteLine(sr.ReadToEnd());
      

  4.   

    function top_check_log() {
    if (document.top_form_log.id.value.length==0) {
    document.top_form_log.id.focus();
    alert("柴镑IDをご掐蜗ください。");return;
    }
    if (document.top_form_log.passwd.value.length==0) {
    document.top_form_log.passwd.focus();
    alert("パスワ〖ドを掐蜗ください。");return;
    -----------------------------------这些内容是乱码的.我懂日语。再次麻烦,谢谢大哥!
      

  5.   

    我取中文网站都遇到这个问题,奇怪的是就出现在alert("")里面,其它地方显示的都是正常的,会不会是服务器返回的这段文字编码不一样呢?我也在郁闷中……