如何保存特殊字符?

时间:2013-02-19 20:17:07

标签: c# .net

我将一些数据保存在.txt文件中,以便我可以在之后加载/读取它,但是某些特殊字符不能正常工作。

我截取了它在字符串中“内部”的截图,因为它在文件中保存了一些符号,当我加载它时,它没有像预期的那样加载。

带有characteres的图像以及它们在字符串中的显示方式:

enter image description here

我正在使用WinAPI代码来编写和读取文件:WritePrivateProfileString()GetPrivateProfileString()

public static void FileWriteValue(string File, string Section, string Key, string Value)
        {
            WritePrivateProfileString(Section, Key, Value, File);
        }

        public static string FileReadValue(string File, string Section, string Key)
        {
            StringBuilder temp = new StringBuilder(100000);
            int i = GetPrivateProfileString(Section, Key, "", temp, 100000, File);
            return temp.ToString();
        }

更新了写入和读取。

0 个答案:

没有答案
相关问题