By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Foreign language and streamreader problem.

P: n/a
I have text file contains word in English language and in
foreign language and I include this text file as embedded
resource in

my project. VB.NET editor can display the foreign langue
of this text file.
create stream reader object to read from this file. The
object can read the data in text file but it seems when I
display it to

screen using streamreader.Readline method, word in foreign
language can not be display in the correct word. It is
displayed

as garbage font.
Do I miss somthing?
This is my code:
' Get the current assembly.
Dim Asm As [Assembly] = [Assembly].GetExecutingAssembly()
strName = Asm.GetName().Name + ".TestText.txt"
' Resources are named using a fully qualified name.
Dim strm As Stream = Asm.GetManifestResourceStream
(strName)

' Read the contents of the embedded file.
Dim reader As StreamReader = New StreamReader(strm)
msgbox( reader.readend )

Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Krich" <mr*****@hotmail.com> scripsit:
I have text file contains word in English language and in
foreign language and I include this text file as embedded
resource in

my project. VB.NET editor can display the foreign langue
of this text file.
create stream reader object to read from this file. The
object can read the data in text file but it seems when I
display it to

screen using streamreader.Readline method, word in foreign
language can not be display in the correct word. It is
displayed

as garbage font.
Do I miss somthing?
This is my code:
' Get the current assembly.
Dim Asm As [Assembly] = [Assembly].GetExecutingAssembly()
strName = Asm.GetName().Name + ".TestText.txt"
' Resources are named using a fully qualified name.
Dim strm As Stream = Asm.GetManifestResourceStream
(strName)

' Read the contents of the embedded file.
Dim reader As StreamReader = New StreamReader(strm)


Notice that there is a constructor available that accepts an encoding in
the 2nd parameter.

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.