This commit is contained in:
sin365 2025-07-21 15:09:45 +08:00
parent 1277c605cd
commit 6c4deb2040
2 changed files with 15 additions and 11 deletions

View File

@ -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
{

View File

@ -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<string, string> mDictSrcData;
static Dictionary<char, char> DictTongJia = new Dictionary<char, char>();
static void Main(string[] args)
@ -97,11 +97,17 @@ namespace AutoRranslateTextToCsv
public static bool LoadCsv(string path, out Dictionary<string, string> _dictSrcData)
{
_dictSrcData = new Dictionary<string, string>();
using (StreamReader sr = new StreamReader(path, Encoding.GetEncoding("gb2312")))
//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];