Unity3d LitJson中文乱码问题

string mainPath = Application.streamingAssetsPath + "/main.txt";
string mainJson = JsonMapper.ToJson(m_ListMainObj);

Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})");
mainJson = reg.Replace(mainJson, delegate (Match m) { return ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString(); });

using(FileStream fs = File.Open(mainPath, FileMode.OpenOrCreate))
{
    // Putting some contents
    Byte[] info = new UTF8Encoding(true).GetBytes(mainJson);
    fs.Write(info, 0, info.Length);
}

你可能感兴趣的:(unity)