code_junkie

Convert GB2312 to UTF-8

Nov 13th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. static void Main(string[] args) {
  2. string infile = args[0];
  3. string outfile = args[1];
  4.  
  5. using (StreamReader sr = new StreamReader(infile, Encoding.GetEncoding(936))) {
  6. using (StreamWriter sw = new StreamWriter(outfile, false, Encoding.UTF8)) {
  7. sw.Write(sr.ReadToEnd());
  8. sw.Close();
  9. }
  10. sr.Close();
  11. }
  12. }
  13.  
  14. Private Shared Sub Main(ByVal args() As String)
  15. Dim infile As String = args(0)
  16. Dim outfile As String = args(1)
  17. Dim sr As StreamReader = New StreamReader(infile, Encoding.GetEncoding(936))
  18. Dim sw As StreamWriter = New StreamWriter(outfile, false, Encoding.UTF8)
  19. sw.Write(sr.ReadToEnd)
  20. sw.Close
  21. sr.Close
  22. End Sub
Add Comment
Please, Sign In to add comment