Question:
I need to display Cyrillic text on my VB6 application. I have a file with large collection of Cyrillic strings (corresponding to error messages, captions etc.) and I need to read one of those strings and display it on a form.
Answer:
First, go to this URL which has an online tool for converting your string to a hex-encoded string:
http://www.chilkatasp.net/HexEncodeString.aspx
You may then use the hex string in as a string literal in your VB6 code:
Private Sub Button_Click()
Dim s As New CkString
s.AppendEncoded "DF20ECEE", "hex", "windows-1251"
DisplayCyrillic s, Text1
End Sub
This is the DisplayCyrillic method:
Private Sub DisplayCyrillic(ByRef s As CkString, ByRef txtbox As TextBox)
Dim b() As Byte
b = s.EmitMultibyte("windows-1251")
Text1.Font.charset = 204
For i = 0 To UBound(b) - 1
Text1.Text = Text1.Text + Chr(b(i))
Next
End Sub
The CkString component may be downloaded from:
http://www.chilkatsoft.com/download/ckString.zip
CkString online reference documentation.