웹 사이트에서 히브리어로 문자열을 찾으려고합니다. 독서 코드가 첨부되어 있습니다.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
검색된 메시지를 인코딩하려고했으나 실패했습니다. string messageToFind = "otherLanguage"; UTF8Encoding utf8 = 새 UTF8Encoding(); Byte [] encodedBytes = utf8.GetBytes (messageToFind); messageToFind = encodedBytes.ToString(); – AYBABTU