Click here to Skip to main content
15,903,012 members

Comments by Himanshu Kimni (Top 8 by date)

Himanshu Kimni 14-Apr-15 5:57am View    
Thanks for your suggestion Richard. Can you please help with this. How can we make a regex pattern to search UTF in an string.
Himanshu Kimni 14-Apr-15 5:45am View    
string utfString = "déj\xa0(’)";

// Create two different encodings.
Encoding ascii1 = Encoding.ASCII;
Encoding utf = Encoding.UTF8;

// Convert the string into a byte array.
byte[] utfBytes = utf.GetBytes(utfString);

// Perform the conversion from one encoding to the other.
byte[] ascii1Bytes = Encoding.Convert(utf, ascii1, utfBytes);

// Convert the new byte[] into a char[] and then into a string.
char[] ascii1Chars = new char[ascii1.GetCharCount(ascii1Bytes, 0, ascii1Bytes.Length)];
ascii1.GetChars(ascii1Bytes, 0, ascii1Bytes.Length, ascii1Chars, 0);
string ascii1String = new string(ascii1Chars);

// Display the strings created before and after the conversion.
Console.WriteLine("Original string: {0}", utfString);
Console.WriteLine("Ascii converted string: {0}", ascii1String);
Console.ReadLine();

But despite of giving output "déj\xa0(')", it is giving wrong output as "dAcjA (â?T)"
Himanshu Kimni 14-Apr-15 5:10am View    
Thanks for your comment Richard. Can you please provide me a sample code.
Himanshu Kimni 7-Apr-15 5:38am View    
Thanks for your comment. Basically I am looking forward for the entity conversion option through which I can convert the UTF-8 entities to hexadecimal/character/html entity.
Himanshu Kimni 2-Apr-15 10:24am View    
I was coded by me many years ago and I have tried to re-write the code but there are some functions which I need to re-use, that is the reason I am looking for some decompiler.