Replacing characters in C# (ascii) -


I found a file with characters like this: Ã, è¨ ¬, ², ø - à ?? The characters that I want to do are replaced with normal characters such as: à = one, ¨ = e and so on ..... this is my code yet:

  StreamWriter sw = new streamer (@ "C: /JoinerOutput.csv"); String path = "C: /Joiner.csv"; String line = file. Read All Lessons (Path); If (line.Contains ( 'A')) {string asAscii = Encoding.ASCII.GetString (Encoding.Convert (Encoding.UTF8, Encoding.GetEncoding (Encoding.ASCII.EncodingName, New EncoderReplacementFallback ( "a"), new DecoderExceptionFallback ( )), Encoding. UTF8.GetBytes (line))); Console.WriteLine (asAscii); Console.ReadLine (); Sw.WriteLine (asAscii); Sw.flush (); }   

Actually it searches for the file for a specific character and changes it with the other. The problem I have is that if my statement does not work I How to go in

This is a sample of the input file:

 Bring it to the ceiling on the front of the trunk, condo modis ¨ jour ¨mia mo Mi Khà ¨thiwè Buthèlèzi Tia nà puppy Y Vivia N ma SWA Nga Nya Thirèshà n Rèddy wa da Cornèlius Anos Nètshimbupfè  

this is output if you use line = Line. Change ('A', 'A'); :

 C�rl�n� Kirst�n M�m� R�tl�di Cross N�l P�s�k� Modis� J�r�mi�h Mor�mi K�thyv� Buth�là ¯Â¿Â½ji Ti�n� Pil�y Vivi�n M�sw�ng�ny� Thir�s�n State The symbol will be completely deleted with my code  

< P> Do not know that this is useful, but to write a message on an LED screen in an internal device, we have the following Replacement (I'm sure the Unicode table has more intelligent ways to do this work, but it is enough for a small internal device):
  st Rmessage = Regex.Replace (strmessage , "[[ÃÆ'Ã,ƒÃ,® Strmessage = Regex.Replace (Strmessage, "[single ?? one ?? one ??]", "e"); strmessage = regex.change (strmessage, "[â € œ] â €" a "); Strmessage = Regex.Replace (strmessage, "[single ?? one ?? one ?? a ?? a ??]", "a"); Strmessage = Regex.Replace (strmessage, "[a áà £ ¥ ¥]", "A"); Strmessage = Regex.Replace (strmessage, "[single ?? one ?? one ??]", "u"); Strmessage = Regex.Replace (strMessage, "[ùúࢠšÃ ¢ â € œÃƒÆ'à ¢ â,¬Å¡Ãƒâ € šÃ, ¢)," U "); Strmessage = Regex.Replace (strMessage, "[ÃÆ'Ã,ƒÃÆ'à à ⠀ ™ Ã⠀ šÃ, · Ã⠀ šÃ,®," o "); Strmessage = Regex.Replace (strmessage, "[single ?? a ?? a ?? a ?? a ??]", "o"); Strmessage = Regex.Replace (strmessage, "[ÃÆ'à ¢ â,¬Å¡Ãƒâ € šÃ,Â]", "i"); Strmessage = Regex.Replace (strmessage, "[single ?? one ?? a ??]", "i"); Strmessage = Regex. Change (strmessage, "[Å¡]", "S"); Strmessage = Regex. Change (strmessage, "[Å]", "S"); Strmessage = Regex.Replace (strmessage, "[one ±]", "n"); Strmessage = Regex.Replace (strmessage, "[single ??]", "n"); Strmessage = Regex. Change (strMessage, "[§ A", "c)); Strmessage = Regex.Replace (strmessage, "[single ??]", "c"); Strmessage = Regex. Change (strmessage, "[ÃÆ'à ¢ â,¬Å¡Ãƒâ € šÃ, ¢]", "y"); Strmessage = Regex. Change (strmessage, "[Å]", "Y"); Strmessage = Regex. Change (strMessage, "[eye]", "z"); Strmessage = Regex. Change (strmessage, "[Ž]", "Z"); Strmessage = Regex.Replace (strmessage, "[single ??]", "D"); Strmessage = Regex. Replace (strmessage, "[Å ??]", "oe"); Strmessage = Regex. Change (strmessage, "[Å ??]", "Oe"); strMessage = Regex.Replace (strMessage, "[a«  »\ u201C \ U201D \ u201E \ u201F \ u2033 \ u2036]", "\" "); strMessage = Regex.Replace (strMessage," [\ u2026] ", "...");   

The noteable thing is that if text is spoken in most languages ​​even after such treatment then this is not always the case and often For the reader to be able to understand that in context of the sentence, if you have to choose between then nothing.


Keep in mind that the correct solution is Unicode The need to use Ikaon, with its "combined marks marks (marks)" Character with integrated characters and then delete Dairektiks ....

Comments