In my code I am dealing with a situation whereby I have some html code that contains a list of actors are saved into a string. Some of the actor's names such as José Ferrer are appearing in the string as José Ferrer. With é being the hexa-decimal representation of é. Does anyone have any idea of how to convert the Hex code to the character code symbol representation in C#.
Update:
I have a function that checks the names, in some cases; character such as é and presented in the string like this: "José Ferrer".
I have a function called RemovedUnicode Characters. Which aims to convert the hed code into it respective character equivalent, however I can't seem to get the function to work, this is what I have so far. The Variable Neartest just returns "é"; it does not return é.
In the code below, I isolated the unicode character reprsentation into the string called entity. By using the for loop o filter through all of the chars in the string input.
public static string RemoveUnicodeCharacterAndProduceLetter(string input) {
StringBuilder output = new StringBuilder(input.Length);
int endIndex;
int startIndex;
int length;
string entity;
for (int i = 0; i < input.Length; i++)
{
if ( input[i] == '&')
{
string startElement = "&";
string endElement = ";";
startIndex = input.IndexOf(startElement);
endIndex = input.IndexOf(endElement, startIndex);
length = endIndex - startIndex;
entity = input.Substring(startIndex, length);
// int tempResult = Convert.ToInt16(entity);
// char chesse = (char)Int16.Parse(entity, NumberStyles.AllowHexSpecifier);
string nearTest = HttpUtility.HtmlDecode(entity).ToString();
// string str = char.ConvertFromUtf32(Convert.ToInt32(entity));
//