Click here to Skip to main content
15,892,674 members
Home / Discussions / C#
   

C#

 
GeneralRe: Closing a exe file Pin
mrithula818-Feb-09 23:11
mrithula818-Feb-09 23:11 
GeneralRe: Closing a exe file Pin
Nuri Ismail18-Feb-09 23:14
Nuri Ismail18-Feb-09 23:14 
Questiondraw a line similar to the one present in ms word Pin
sabeel alwosol18-Feb-09 2:59
sabeel alwosol18-Feb-09 2:59 
AnswerRe: draw a line similar to the one present in ms word Pin
Thomas Stockwell18-Feb-09 4:22
professionalThomas Stockwell18-Feb-09 4:22 
QuestionCompare file length and lines of data in 2 files inside a zip file Pin
Member 322226418-Feb-09 2:56
Member 322226418-Feb-09 2:56 
AnswerRe: Compare file length and lines of data in 2 files inside a zip file Pin
Deresen18-Feb-09 4:03
Deresen18-Feb-09 4:03 
QuestionCross domain AD search Pin
NanaAM18-Feb-09 2:03
NanaAM18-Feb-09 2:03 
QuestionUnwanted Dash in HTTP request string Pin
cfoxtrot18-Feb-09 1:44
cfoxtrot18-Feb-09 1:44 
Dear all,

I am doing some screen scraping work and I am making a web request to web page that is encoded in IS0-8859-1. In order to be able to get the special characters such as the apostrope correct, I had to change the encoding of the response to windows-1252.

The following is my web request/response code:
public static string GetHTMLStringWin(string url)
     {
         StringBuilder html = new StringBuilder();
         string htmlToRet = null;
         try
         {
             //-- Make an HTTP web request to retrieve content --//
             HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
             request.Timeout = 30000;
             HttpWebResponse response = (HttpWebResponse)request.GetResponse();
             Stream htmlStream = response.GetResponseStream();
             string temp = null;
             byte[] buffer = new byte[9000];
             int counter = 0;

             do
             {
                 counter = htmlStream.Read(buffer, 0, buffer.Length);
                 if (counter != 0)
                 {
                     //-- The encoding is set to UTF-8 --//
                     temp = Encoding.GetEncoding("windows-1252").GetString(buffer, 0, counter);
                     //temp = Encoding.GetEncoding("iso-8859-1").GetString(buffer, 0, counter);
                     html.Append(temp);
                 }

             }
             while (counter > 0);

             htmlToRet = html.ToString();
         }
         catch
         {
             htmlToRet = null;
             //-- Add Exception Logic here --//
         }
         return htmlToRet;
     }


The apostrophe is interpreted well using this method, however i am getting unwanted dashes in the text. For example the word periti is becoming pe-ri-ti. I believe that this has to be some encoding issue. The target webpage is interpreted correctly in a web browser.

Any suggestions of how may I solve this?

Many thanks,
Chris
QuestionUsing PowerPoint Application in .net Pin
nameen18-Feb-09 1:06
nameen18-Feb-09 1:06 
Questiondrawing lines at runtime Pin
maisa.z18-Feb-09 0:30
maisa.z18-Feb-09 0:30 
AnswerRe: drawing lines at runtime Pin
J4amieC18-Feb-09 0:41
J4amieC18-Feb-09 0:41 
AnswerRe: drawing lines at runtime Pin
dan!sh 18-Feb-09 2:15
professional dan!sh 18-Feb-09 2:15 
QuestionFinding controls in datagridview dynamically Pin
Nitin K17-Feb-09 23:52
Nitin K17-Feb-09 23:52 
AnswerRe: Finding controls in datagridview dynamically Pin
Calin Tatar18-Feb-09 0:50
Calin Tatar18-Feb-09 0:50 
GeneralRe: Finding controls in datagridview dynamically Pin
Nitin K18-Feb-09 2:20
Nitin K18-Feb-09 2:20 
GeneralRe: Finding controls in datagridview dynamically Pin
Calin Tatar18-Feb-09 2:26
Calin Tatar18-Feb-09 2:26 
GeneralRe: Finding controls in datagridview dynamically Pin
Calin Tatar18-Feb-09 2:35
Calin Tatar18-Feb-09 2:35 
QuestionVisual Studio Setup Project, how to make sure files are overwritten. Pin
^mrc^17-Feb-09 23:41
^mrc^17-Feb-09 23:41 
AnswerRe: Visual Studio Setup Project, how to make sure files are overwritten. Pin
Mirko198018-Feb-09 0:02
Mirko198018-Feb-09 0:02 
QuestionHow to set user-defined-type as Oracle SP input parameter in .NET Pin
AnilJayanti17-Feb-09 23:19
AnilJayanti17-Feb-09 23:19 
AnswerRe: How to set user-defined-type as Oracle SP input parameter in .NET Pin
ABitSmart18-Feb-09 0:46
ABitSmart18-Feb-09 0:46 
AnswerHow to use user-defined-type input and output parameters in Oracle Function using ODP.NET Pin
AnilJayanti18-Feb-09 22:09
AnilJayanti18-Feb-09 22:09 
QuestionHow to override Button Click EventArgs or use another ways to achieve it? Pin
mctramp16817-Feb-09 21:10
mctramp16817-Feb-09 21:10 
AnswerRe: How to override Button Click EventArgs or use another ways to achieve it? Pin
dan!sh 17-Feb-09 21:33
professional dan!sh 17-Feb-09 21:33 
GeneralRe: How to override Button Click EventArgs or use another ways to achieve it? Pin
mctramp16817-Feb-09 22:40
mctramp16817-Feb-09 22:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.