Foreign language and streamreader problem.

K

Krich

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 )
 
H

Herfried K. Wagner [MVP]

Krich said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top