Console ascii problem

  • Thread starter Thread starter JR
  • Start date Start date
J

JR

Hi,



I write a console program and some characters are not correct when I
rederect the output to a file

this are the textes that gives problems.

Dim c1 As String = " ?" '179¦

Dim c2 As String = " ?" '192+

Dim c3 As String = " ?" '195+

Dim c4 As String = "? " '196



the came out the file as: ² Ä



how can I solve this.



Jan
 
Check Encoding class and conversions for specific code pages. Also, you need
to check CultureInfo.CurrentUICulture.

HTH
Alex
 
I write a console program and some characters are not correct when I
rederect the output to a file

this are the textes that gives problems.

Dim c1 As String = " ?" '179¦

Dim c2 As String = " ?" '192+

Dim c3 As String = " ?" '195+

Dim c4 As String = "? " '196



the came out the file as: ² Ä


Which program do you use to look at the file?


Mattias
 
I write a console program and some characters are not correct when I
rederect the output to a file
this are the textes that gives problems.
Dim c1 As String = " ?" '179¦
Dim c2 As String = " ?" '192+
Dim c3 As String = " ?" '195+
Dim c4 As String = "? " '196
the came out the file as: ² Ä

Which program do you use to look at the file?

Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.orghttp://www.msjogren.net/dotnet/|http://www.dotnetinterop.com
Please reply only to the newsgroup.- Tekst uit oorspronkelijk bericht niet weergeven -

- Tekst uit oorspronkelijk bericht weergeven -

the good old notepad
 
Check Encoding class and conversions for specific code pages. Also, you need
to check CultureInfo.CurrentUICulture.

HTH
Alex















- Tekst uit oorspronkelijk bericht weergeven -

Do you have some examples
Jan
 
For console
String.Format (IFormatProvider, String, Object[])




For file
StreamWriter (Stream, Encoding) Initializes a new instance of
the StreamWriter class for the specified stream, using the specified
encoding and the default buffer size.
Try Encoding.Convert (Encoding, Encoding, Byte[]) Converts an entire
byte array from one encoding to another.


Exact approach depends on your thread culture, windows culture and
file culture. You might have all three different.

Can you post your code demonstrating issue?

Replaces the format item in a specified String with the text
equivalent of the value of a corresponding Object instance in a specified
array. A specified parameter supplies culture-specific formatting
information.






Check Encoding class and conversions for specific code pages. Also, you
need
to check CultureInfo.CurrentUICulture.

HTH
Alex















- Tekst uit oorspronkelijk bericht weergeven -

Do you have some examples
Jan
 
Back
Top