我想在网站中找到一个希伯来语字符串。阅读代码已附上。用c#阅读非英文html页面
然后我尝试使用streamReader读取文件,但无法匹配其他语言的字符串。 我想要做什么?
// used on each read operation
byte[] buf = new byte[8192];
// prepare the web page we will be asking for
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("http://www.webPage.co.il");
// execute the request
HttpWebResponse response = (HttpWebResponse)
request.GetResponse();
// we will read data via the response stream
Stream resStream = response.GetResponseStream();
string tempString = null;
int count = 0;
FileStream fileDump = new FileStream(@"c:\dump.txt", FileMode.Create);
do
{
count = resStream.Read(buf, 0, buf.Length);
fileDump.Write(buf, 0, buf.Length);
}
while (count > 0); // any more data to read?
fileDump.Close();
仍然没有... 我觉得我的问题可能与搜索到的字符串有关,我的意思是我不能匹配: str.contains(“other language code”); 对不对? 我想要做什么? – AYBABTU 2010-06-09 18:12:47
我试图编码搜索到的消息,但它也失败 string messageToFind =“otherLanguage”; UTF8Encoding utf8 = new UTF8Encoding(); Byte [] encodedBytes = utf8.GetBytes(messageToFind); messageToFind = encodedBytes.ToString(); – AYBABTU 2010-06-09 18:15:51