MIIS出现“stopped-file-embedded-nulls”错误的处理

转帖:extensible MA import drops spaces causes import error - TechNet Forums

今天在试验MIIS时出现了“stopped-file-embedded-nulls”的错误,在网上查询了一下,原来是编码的问题。

Hello Paul!

I have found that when I write Extensible MA's that the formatting need be exactly correct or you can run into issues that cause the import not to run successfully

Since, throwing the Encoding.Unicode into the overload made sense, I used this call once to init my StreamWriter:

Code Snippet

StreamWriter sw = new StreamWriter(strFilePath, true,Encoding.Unicode)

and I was receiving "stopped-file-embedded-nulls" errors on import.  I looked in the file and I couldn't tell what was going on.  I made sure there were no trailing carriage returns or no trailing spaces.  I even tried to parse out all of the nulls:

Code Snippet

szCSVString.Replace('\u0000', '\u0020')

I haven't figured out what fixed the issue, whether it be the string replacement for nulls, modifying the streamwriter or removing the last carriage return, but it finally started working when I took the Encoding overload out of the StreamWriter:

Code Snippet

StreamWriter sw = new StreamWriter(strFilePath, true)

The moral of the story, MIIS is super sensitive with regards to data type importing.  If you need trailing spaces on import or export, I would find a Unicode character to replace the space that you know you're not going to use.  For my testing, I use a tilde (~).  I would then specify to look for the trailing spaces on the way in and the tilde on the way out of the Extensible MA. 

Let us know how it goes.

--Shawn

上面是源文。

我检查了代码中使用生成文件的编码格式是:System.Text.Encoding.Unicode

MA设置的编码是其它编码,现在 修改成System.Text.Encoding.Unicode后,问题解决。

转载于:https://www.cnblogs.com/LifelongLearning/articles/1342410.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值