【问题标题】:Unsupported encoding while parsing excel解析excel时不支持的编码
【发布时间】:2019-07-09 07:23:25
【问题描述】:

我使用以下代码使用ExcelDataReader 打开一个Excel 文件。

excelReader = ExcelReaderFactory.CreateReader(stream, new ExcelReaderConfiguration()
            {
                FallbackEncoding = Encoding.UTF8,

                LeaveOpen = false,

                AnalyzeInitialCsvRows = 0,
            });

问题是我收到以下错误,

无法找到编码 1252 的数据。确保你有正确的 已安装并启用国际代码集程序集。

基于其他解决方案,我还将i18N.dlli18n.west.dll 文件添加到我的项目中,但问题仍然存在。

【问题讨论】:

  • 尝试在 Assets 文件夹中创建一个名为“DLL”的文件夹?尝试将 Unity\Editor\Data\Mono\lib\mono\unity 中的所有 DLL 添加到该文件夹​​,然后重试。还将脚本后端从 IL2CPP 更改为 Mono2x。
  • 是的,我试过这样做,但我仍然面临同样的问题:(
  • 也试试这个解决方案https://stackoverflow.com/questions/44162955/unity-html5-error-encoding-1252-data-could-not-be-found

标签: c# android excel unity3d exceldatareader


【解决方案1】:

我用过:

FallbackEncoding = Encoding.GetEncoding(1252);

我的代码:

ExcelReaderConfiguration conf = new ExcelReaderConfiguration();
conf.FallbackEncoding = Encoding.GetEncoding(1252);


using (IExcelDataReader reader = ExcelReaderFactory.CreateReader(stream, conf))
{
....
}
                {

【讨论】:

    猜你喜欢
    • 2013-10-16
    • 2019-05-21
    • 2021-10-24
    • 2013-03-31
    • 2020-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多