c# - Ubuntu 16.04 下 C# 单声道项目的 windows-1251 编码
问题描述
我艰难的生活迫使我在 Ubuntu 16.04 下的 C# 上使用“windows-1251”编码。我使用“单声道”来运行 C#。
两个命令
Encoding.GetEncoding(1251)
Encoding.GetEncoding("windows-1251")
给这个例外
System.NotSupportedException: Encoding 1251 data could not be found. Make sure you have correct international codeset assembly installed and enabled.
at System.Text.Encoding.GetEncoding (System.Int32 codepage) [0x0023f] in <65984520577646ec9044386ec4a7b3dd>:0
根据这个答案,我需要使用
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
但我的 c# 找不到“RegisterProvider”。据我了解,我需要手动包含“System.Text.Encoding.CodePages”。评论中描述了一些步骤,但我不明白在哪里可以下载它以及如何链接它。
有人可以建议我如何包含它(如果它解决了问题)或告诉我一般该怎么做。
解决方案
推荐阅读
- r - 如何通过反应性在闪亮中添加递归模块
- c# - 如何使用 Selenium C# 在 Chrome 中禁用下载警告?
- javascript - Nextjs 上的 ContentEditable,更新未显示在状态
- c++ - 类无法访问其自己的私有静态 constexpr 方法 - Clang 错误?
- jquery - jsTree:AJAX 调用后刷新内容然后打开所有
- sql-server - 在 Oracle SQL 中重写 SQL-Server 中的触发器
- angular7 - 组件中的角度反应式表单组清除错误未从模板中清除
- mysql - sql数据库中的条件
- ios - 是否可以使用 Xcode 使游戏控制器振动?
- android - 是否可以在开始下载之前获得动态功能模块大小?