Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. StreamReader read = new StreamReader(@"D:(path)");
  2.  
  3. StreamWriter write = new StreamWriter(@"D:(path)");
  4.  
  5. Encoding ANSI = Encoding.GetEncoding(1252);
  6. Encoding UTF8 = Encoding.UTF8;
  7. byte[] utf8_bytes,ansi_bytes;
  8.  
  9. utf8_bytes = UTF8.GetBytes(read.ReadLine());
  10. ansi_bytes = Encoding.Convert(UTF8, ANSI, utf8_bytes);
  11.  
  12. string ansi_str = ANSI.GetString(ansi_bytes);
  13.  
  14. write.WriteLine(ansi_str);
  15.  
  16. read.Close();
  17. write.Close();
  18.  
  19. StreamReader read = new StreamReader(@"D:(path)");
  20.  
  21. StreamWriter write = new StreamWriter(@"D:(path)");
  22.  
  23. Encoding ANSI = Encoding.GetEncoding(1251);
  24. Encoding UTF8 = Encoding.UTF8;
  25. byte[] utf8_bytes,ansi_bytes;
  26.  
  27. utf8_bytes = UTF8.GetBytes(read.ReadLine());
  28. ansi_bytes = Encoding.Convert(UTF8, ANSI, utf8_bytes);
  29.  
  30. string ansi_str = ANSI.GetString(ansi_bytes);
  31.  
  32. write.WriteLine(ansi_str);
  33.  
  34. read.Close();
  35. write.Close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement