Set Eastern European or other character set ?

mickle026

Member
Joined
Oct 31, 2009
Messages
20
Programming Experience
3-5
Can anyone help me , I need to know if I am setting the font correctly. I can do this in VB6 but cannot in Vb.net

I am loading a text file to an array like this:

VB.NET:
    Private Sub LoadFile()
        'read the file
        
        Dim FILE_NAME As String = FilePath + "Transport.lin2"

        Dim fStream = New System.IO.FileStream(FILE_NAME, IO.FileMode.Open)
        Dim sReader = New System.IO.StreamReader(fStream)
        Do While sReader.Peek >= 0
            ReDim Preserve sArray(Index)
            sArray(Index) = sReader.ReadLine
            Index += 1
        Loop

        fStream.Close()
        sReader.Close()
    End Sub

sArray is of data type object.
Then I am trying to display the Polish charaterset in a label using codepage 238 Eastern European.
words such as car (samoch?d)<-- ? (is an 'o' with accent) do not display correctly (samoch�d) <--(the symbol is actually a little square)

VB.NET:
lblLanguage1.Font = New Font("Veranda", 10, FontStyle.Bold, GraphicsUnit.Point, 238)
lblLanguage1.text =sArray(0)


My file is unicode, but I have tried saving as text only default and in ansi. Does any one know how to load it and display it correctly. I have other languages i wish to do this to as well so I need to set the control codepage.

Many thanks
 
OK figured it out.

What I was doing IS correct, but the text file needs to be saved in UTF-8 for it to display properly in the controls.
 

Latest posts

Back
Top