Как получить специальные символы в C# с помощью memorystream.
I want to get the string data with special characters like below. Á,õn O'kim José Nuñez JOSNUÑ44 but the special characters are missing while get back by using the below logic. using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SpecialCharacters { class Program { static void Main(string[] args) { string specialcharactersdata = @"Á,õn O'kim José Nuñez JOSNUÑ44 "; Console.WriteLine(specialcharactersdata); using (MemoryStream ms = new MemoryStream(System.Text.ASCIIEncoding.UTF8.GetBytes(specialcharactersdata))) { StreamWriter sw = new StreamWriter(ms); sw.Flush(); ms.Position = 0; StreamReader sr = new StreamReader(ms); string myStr = sr.ReadToEnd(); Console.WriteLine(myStr); Console.Read(); } } } } Could you please help me how to get exact text or string with special characters. Á,õn O'kim José Nuñez JOSNUÑ44
Что я уже пробовал:
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SpecialCharacters { class Program { static void Main(string[] args) { string specialcharactersdata = @"Á,õn O'kim José Nuñez JOSNUÑ44 "; Console.WriteLine(specialcharactersdata); using (MemoryStream ms = new MemoryStream(System.Text.ASCIIEncoding.UTF8.GetBytes(specialcharactersdata))) { StreamWriter sw = new StreamWriter(ms); sw.Flush(); ms.Position = 0; StreamReader sr = new StreamReader(ms); string myStr = sr.ReadToEnd(); Console.WriteLine(myStr); Console.Read(); } } } }
выходим ставим как ниже:
A,on O'kim José Nuñez JOSNUÑ44 A,on O'kim José Nuñez JOSNUÑ44
Но я хочу поставить как ниже:
Á,õn O'kim José Nuñez JOSNUÑ44