流阅读器垃圾字符问题 [英] Stream Reader Junk Character Issue

查看:82
本文介绍了流阅读器垃圾字符问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MSDN团队

我在我的代码中使用流阅读器来读取.txt文件中的数据。这个文件中间包含一个垃圾字符,但是流读取器在垃圾字符之前的字符串和垃圾字符之后的剩余字符串被视为新的
行的字符串,因此代码失败。这我已经提到如下:

I am using stream reader in my code to read data from a .txt file.This file contains a junk character in between but the stream reader the string before the junk character and remaining string after the junk character is considered as a string of new line due to this the code is failing.This I have mentioned as below:

FIle数据:23340516 | REED ELSE<<小方块>> VIER CAP RC A | MATD |

FIle Data : 23340516|REED ELSE<<small square block>>VIER CAP RC A|MATD|

Stream Reader读取如下:

Stream Reader reads it as below:

23340516 | REED ELSE

VIER CAP RC A | MATD |

23340516|REED ELSE
VIER CAP RC A|MATD|

流阅读器可以从文件中读取这样的垃圾字符吗?如果是这样,请让我知道摆脱这个问题的解决方案。

Can stream reader read such junk charcters from a file? If so please let me knkow the solution to get rid of this issue.

谢谢| Arnab

推荐答案

我怀疑,它不是垃圾角色。它看起来像一个新的行字符(Char(13)/ char(10)),它是不可打印的。
I doubt, it is not a Junk Character. It looks like a new line character( Char (13) / char(10) ), which are non printable.


这篇关于流阅读器垃圾字符问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆