diff --git a/FileHelper.cs b/FileHelper.cs index 74f4f61..68209da 100644 --- a/FileHelper.cs +++ b/FileHelper.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; +using System.Text; namespace AutoRranslateTextToCsv { diff --git a/Program.cs b/Program.cs index 95b458d..8fda757 100644 --- a/Program.cs +++ b/Program.cs @@ -11,7 +11,7 @@ namespace AutoRranslateTextToCsv const string InDir = "Input"; const string OutDir = "Out"; const string SrcDataFile = "_TextDictionary.csv"; - const string Ver = "0.5"; + const string Ver = "0.8"; static Dictionary mDictSrcData; static Dictionary DictTongJia = new Dictionary(); static void Main(string[] args) @@ -96,12 +96,18 @@ namespace AutoRranslateTextToCsv public static bool LoadCsv(string path, out Dictionary _dictSrcData) { - _dictSrcData = new Dictionary(); - using (StreamReader sr = new StreamReader(path, Encoding.GetEncoding("gb2312"))) + _dictSrcData = new Dictionary(); + //using (StreamReader sr = new StreamReader(path, Encoding.GetEncoding("gb2312"))) + using (StreamReader sr = new StreamReader(path, new UTF8Encoding(true))) { - + int linecount = -1; while (!sr.EndOfStream) { + linecount++; + if (linecount == 45982) + { + + } string line = sr.ReadLine(); string[] values = line.Split(','); if (values.Length >= 2) @@ -166,7 +172,10 @@ namespace AutoRranslateTextToCsv for (int j = 0; j < valueArr.Length; j++) { if (j == 3) - newline += EncodingConvert(Encoding.GetEncoding("gb2312"), Encoding.GetEncoding("shift-jis"), Resultline); + { + //newline += EncodingConvert(Encoding.GetEncoding("gb2312"), Encoding.GetEncoding("shift-jis"), Resultline); + newline += EncodingConvert(new UTF8Encoding(true), Encoding.GetEncoding("shift-jis"), Resultline); + } else newline += valueArr[j];