Russian text output

  • Thread starter Thread starter Aleks Kleyn
  • Start date Start date
A

Aleks Kleyn

I use vb code to show information from SQL Server on the screen. I have
Russian text in this data. Everything is fine, but when I save this
information into file using code
streamwriter1.write(...)
But when I look into file I see text which is different from text that I
wrote. How I can fix this problem?
Thank you, Aleks.
 
I am assuming the text is unicode...

You need to make sure you are using a unicode font to view the text.
If you are opening the file to view it with notepad, make sure you have
a font like Arial Unicode selected.
 
I am assuming the text is unicode...

You need to make sure you are using a unicode font to view the text.
If you are opening the file to view it with notepad, make sure you have
a font like Arial Unicode selected.
 
I agree with this answer. I like when somebody decides which language and
for which purpose I should use. However I found answer
StreamWriter1 = New System.IO.StreamWriter("math.HO-0609472.tex",
False, System.Text.ASCIIEncoding.UTF8, 1000)
Because I selected to use Russian for code greater 128 this code works as I
expected.
Aleks
 
However it is not everything is good in this code. I use pdftex program to
convert tex file (here I create tex file using vb.net application) into pdf
file. However pdftex sees additional symbols in the start of each row. Now
the question is that I need to get rid of these symbols.
Aleks
 
StreamWriter1 = New System.IO.StreamWriter("math.HO-0609472.tex",
False, System.Text.ASCIIEncoding.UTF8, 1000)
Because I selected to use Russian for code greater 128 this code works as I
expected.

But then...
However it is not everything is good in this code. I use pdftex program to
convert tex file (here I create tex file using vb.net application) into pdf
file. However pdftex sees additional symbols in the start of each row. Now
the question is that I need to get rid of these symbols.

Are you sure pdftex can handle UTF8? UTF8 will encode specific chars
into two, three or four bytes. Specifically, it seems that the chars
from the range U+0080 to U+00FF (Ansi chars from 128 to 255) will be
encoded into two bytes. This may confuse some programs.

Because you mention "code greater [than] 128", I suppose you're
actually dealing with Ansi chars. If that's the case maybe using the
cyrillic Ansi charset will solve the problem:

StreamWriter1 = New System.IO.StreamWriter( _
"math.HO-0609472.tex", False, _
System.Text.Encoding.GetEncoding(1251), _
1000)

HTH.

Regards,

Branco.
 
Yes, it works. By the way, I use cp1251 encoding for Babel package. But it
was not clear how to match it from VB code. I also put attention that old
fashioned operator fileopen, printline also works.

Thank you, Aleks Kleyn
 
Back
Top