Created
September 15, 2018 23:51
-
-
Save Const-me/7c787cb4f4e5bcb2e5c0d8e40ff5cf18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
using System.IO; | |
namespace ChineeseDecode | |
{ | |
class Program | |
{ | |
static void main( string path ) | |
{ | |
Encoding enc = Encoding.GetEncoding( 936 ); // Codepage #936 "Chinese Main Land" | |
string all; | |
using( var f = new StreamReader( path, enc ) ) | |
all = f.ReadToEnd(); | |
File.Delete( path ); | |
using( var f = new StreamWriter( path, false, Encoding.UTF8 ) ) | |
f.Write( all ); | |
} | |
static void Main( string[] args ) | |
{ | |
try | |
{ | |
main( args[ 0 ] ); | |
} | |
catch( Exception ex ) | |
{ | |
Console.WriteLine( ex.Message ); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment