Click here to Skip to main content
15,920,111 members
Home / Discussions / C#
   

C#

 
AnswerRe: HTml Encoding Pin
Anthony Mushrow22-Oct-08 13:22
professionalAnthony Mushrow22-Oct-08 13:22 
What you're trying to do is get the ascii values of your string. It's not actually HTML which is why the functions aren't doing what you expected.

What you need is something like this, where you go through each character in your string and get the ascii value. Oh and you need it in hexadecimal rather than decimal:

string Encode(string input)
{
  StringBuilder sr = new StringBuilder();
  //go through each letter in your string
  foreach(char character in input)
  {
    int value = (int)character;
    sr.Append('%');
    //ToString("X") formats a decimal as hexadecimal
    sr.Append(value.ToString("X"));
  }  
  return sr.ToString();
}


EDIT: Woah, missed the pre tags there.

My current favourite word is: Nipple!
-SK Genius

Game Programming articles start -here[^]-

GeneralRe: HTml Encoding Pin
Fayu22-Oct-08 13:23
Fayu22-Oct-08 13:23 
JokeRe: HTml Encoding Pin
Anthony Mushrow22-Oct-08 13:28
professionalAnthony Mushrow22-Oct-08 13:28 
AnswerFigured it out Pin
Fayu22-Oct-08 13:22
Fayu22-Oct-08 13:22 
GeneralRe: Figured it out [modified] Pin
Guffa22-Oct-08 14:57
Guffa22-Oct-08 14:57 
GeneralRe: Figured it out Pin
Fayu24-Oct-08 18:46
Fayu24-Oct-08 18:46 
Questionmonitor and control screen from anothe machine Pin
Mohammed Elkholy22-Oct-08 11:15
Mohammed Elkholy22-Oct-08 11:15 
AnswerRe: monitor and control screen from anothe machine Pin
Abhijit Jana22-Oct-08 18:10
professionalAbhijit Jana22-Oct-08 18:10 
GeneralRe: monitor and control screen from anothe machine Pin
Mohammed Elkholy23-Oct-08 6:39
Mohammed Elkholy23-Oct-08 6:39 
Questionaccessing to slack space in doc. file Pin
Miss_hacker22-Oct-08 10:41
Miss_hacker22-Oct-08 10:41 
QuestionHiding resize arrows on windows form Pin
Zeddan22-Oct-08 8:17
Zeddan22-Oct-08 8:17 
AnswerRe: Hiding resize arrows on windows form Pin
Wendelius22-Oct-08 8:52
mentorWendelius22-Oct-08 8:52 
GeneralRe: Hiding resize arrows on windows form Pin
DaveyM6922-Oct-08 9:02
professionalDaveyM6922-Oct-08 9:02 
JokeRe: Hiding resize arrows on windows form Pin
Wendelius22-Oct-08 9:08
mentorWendelius22-Oct-08 9:08 
GeneralRe: Hiding resize arrows on windows form Pin
Zeddan22-Oct-08 9:05
Zeddan22-Oct-08 9:05 
GeneralRe: Hiding resize arrows on windows form Pin
Wendelius22-Oct-08 9:12
mentorWendelius22-Oct-08 9:12 
AnswerRe: Hiding resize arrows on windows form Pin
DaveyM6922-Oct-08 8:52
professionalDaveyM6922-Oct-08 8:52 
QuestionHow to display dynamic drop downlists in a string. Pin
pnagubandi22-Oct-08 8:07
pnagubandi22-Oct-08 8:07 
AnswerRe: How to display dynamic drop downlists in a string. Pin
Wendelius22-Oct-08 8:54
mentorWendelius22-Oct-08 8:54 
QuestionRe: How to display dynamic drop downlists in a string. Pin
josephbhaskar23-Oct-08 3:30
josephbhaskar23-Oct-08 3:30 
Questionhelp on BindingList needed Pin
ahmadbakro22-Oct-08 7:14
ahmadbakro22-Oct-08 7:14 
AnswerRe: help on BindingList needed Pin
Wendelius22-Oct-08 9:01
mentorWendelius22-Oct-08 9:01 
QuestionTabControl and GetType() Pin
zaboboa22-Oct-08 7:11
zaboboa22-Oct-08 7:11 
AnswerRe: TabControl and GetType() Pin
Wendelius22-Oct-08 9:05
mentorWendelius22-Oct-08 9:05 
QuestionText to speech for non supported languages Pin
RaFaYeLlOoOo22-Oct-08 6:56
RaFaYeLlOoOo22-Oct-08 6:56 

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.