2012-04-11 46 views
0

我有這樣的代碼:WP 7 - HttpWebRequest的編碼ISO-8859-2

private void HandleWebResponse(IAsyncResult asyncResult) 
    { 
     WebRequestState state = (WebRequestState)asyncResult.AsyncState; 

     HttpWebRequest request = state.Request; 
     string url = request.RequestUri.ToString(); 
     state.Response = (HttpWebResponse)request.EndGetResponse(asyncResult); 
     string absolutePath = state.Response.ResponseUri.AbsolutePath; 


     if (state.Response != null) 
     { 
      StreamReader reader = new StreamReader(state.Response.GetResponseStream(),Encoding.GetEncoding("ISO-8859-1")); 
      StringBuilder sb = new StringBuilder(); 
      while (!reader.EndOfStream) 
       sb.Append(reader.ReadLine()); 
      ... 

而且我有網頁與編碼ISO-8859-2,但WP7 doesn't支持這種編碼。我怎樣才能將這種編碼轉換爲另一種?或者你有提示如何繞過這個問題? Thx爲每一個建議。

+1

如果不支持iso-8859-2,則可以嘗試使用iso-8859-16並查看結果。這兩個字符集之間有很多相似之處。 – 2012-04-11 12:18:43

回答