C#如何将GBK编码转UTF-8编码?

taoxichen 2020-03-17 03:28:14
C#如何将GBK编码转UTF-8编码?
...全文
753 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
assky124 2020-03-18
  • 打赏
  • 举报
回复
private void ChangeEncode(Encoding fromCoding,Encoding toCoding,string fileName) { var text = System.IO.File.ReadAllText(fileName,fromCoding); System.IO.File.WriteAllText(fileName, text, toCoding); } 大概这样
taoxichen 2020-03-17
  • 打赏
  • 举报
回复
引用 1 楼 lindexi_gd 的回复:
所有存放在内存中使用的都是 Utf16 字符串,编码只是对应文件来说,详细请看我博客 [win10 uwp 读取文本GBK错误](https://blog.lindexi.com/post/win10-uwp-%E8%AF%BB%E5%8F%96%E6%96%87%E6%9C%ACGBK%E9%94%99%E8%AF%AF.html ) [dotnet core 使用 GBK 编码](https://blog.lindexi.com/post/dotnet-core-%E4%BD%BF%E7%94%A8-GBK-%E7%BC%96%E7%A0%81.html )
具体该怎么做?
lindexi_gd 2020-03-17
  • 打赏
  • 举报
回复
所有存放在内存中使用的都是 Utf16 字符串,编码只是对应文件来说,详细请看我博客

[win10 uwp 读取文本GBK错误](https://blog.lindexi.com/post/win10-uwp-%E8%AF%BB%E5%8F%96%E6%96%87%E6%9C%ACGBK%E9%94%99%E8%AF%AF.html )

[dotnet core 使用 GBK 编码](https://blog.lindexi.com/post/dotnet-core-%E4%BD%BF%E7%94%A8-GBK-%E7%BC%96%E7%A0%81.html )

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧