Home All Groups Group Topic Archive Search About
Author
10 Mar 2005 10:46 AM
Guoqi Zheng

Dear sir,

I am using streamreader to read and process some text file. Some times,
those text file contains special characters such as Chinese. StreamReader
will halt when reading those special characters.  Does some one know what
happen?

Here is what I used.
Dim sr As StreamReader = New StreamReader(FileName, New
System.Text.UTF8Encoding)

rStr = sr.ReadToEnd

sr.Close()



Below is an example of the text file.

服装批发,批发服装,服&#
35013;批发市场,外贸服装&#252
09;发,广州服装批发,日&#38889
;服装批发,广州服装批&#
21457;市场,广州外贸服装&#252
09;发,台湾服装批发,上&#28023
;外贸服装批发,北京外&#
36152;服装批发,杭州外贸&#263
81;装批发,广州
瑞丽服饰,广州瑞丽外&#3
6152;服
Author
10 Mar 2005 10:54 AM
Sean Hederman
I haven't got much experience with localization issues, but I'd imagine that
your problem is because of your encoding. To use Unicode characters, you
should have a Unicode encoding, rather than UTF8.

Show quoteHide quote
"Guoqi Zheng" <n*@sorry.com> wrote in message
news:euvqv5VJFHA.1308@TK2MSFTNGP15.phx.gbl...
> Dear sir,
>
> I am using streamreader to read and process some text file. Some times,
> those text file contains special characters such as Chinese. StreamReader
> will halt when reading those special characters.  Does some one know what
> happen?
>
> Here is what I used.
> Dim sr As StreamReader = New StreamReader(FileName, New
> System.Text.UTF8Encoding)
>
> rStr = sr.ReadToEnd
>
> sr.Close()
>
>
>
> Below is an example of the text file.
>
> &#26381;&#35013;&#25209;&#21457;,&#25209;&#21457;&#26381;&#35013;,&#26381;&#
> 35013;&#25209;&#21457;&#24066;&#22330;,&#22806;&#36152;&#26381;&#35013;&#252
> 09;&#21457;,&#24191;&#24030;&#26381;&#35013;&#25209;&#21457;,&#26085;&#38889
> ;&#26381;&#35013;&#25209;&#21457;,&#24191;&#24030;&#26381;&#35013;&#25209;&#
> 21457;&#24066;&#22330;,&#24191;&#24030;&#22806;&#36152;&#26381;&#35013;&#252
> 09;&#21457;,&#21488;&#28286;&#26381;&#35013;&#25209;&#21457;,&#19978;&#28023
> ;&#22806;&#36152;&#26381;&#35013;&#25209;&#21457;,&#21271;&#20140;&#22806;&#
> 36152;&#26381;&#35013;&#25209;&#21457;,&#26477;&#24030;&#22806;&#36152;&#263
> 81;&#35013;&#25209;&#21457;,&#24191;&#24030;
> &#29790;&#20029;&#26381;&#39280;,&#24191;&#24030;&#29790;&#20029;&#22806;&#3
> 6152;&#26381;
>
>

Bookmark and Share