I'm printing some strings to the output console to visualise an array, so I'm looping though a string array and using Debug.Write(array[x,y] + "\t") etc...

All was fine before I went to bed, and the output was fine, like this.

"type-b flat three core 29/03/2015 23:34 6 £13.65 wire grade"

But this morning, I boot computer, load project and now It does not seem to print the "£".

"type-b flat three core 29/03/2015 23:34 6 �13.65 wire grade"

I'm at a loss why this would just suddenly occur. I have not made any changes to the source file "file.csv" file or any part of the code, in fact the very last thing I done before shutting down computer was check the output.

However I looked for what could be wrong and found a few people suggesting to add this. Console.OutputEncoding = System.Text.Encoding.Unicode; But trying that causes a System.IO.IOException, no matter what format I try BigendianUnicode, UTF8, ASCII etc..

My console font is truetype, I think "consola" or simlar word, I also tried something like "lucinda console" which was also truetype.

I'm really flummoxed on this one.

Any ideas?

Where the above problem is showing "?" my console does not show that, it shows some other symbol, like a diamond shape.

I should also add that when I open the original csv in EXcel where the £ symbol is it has what looks like an Á before it.

I'm fairly sure that source csv file has ANSI encoding.

Edited by Suzie999

3 Years
Discussion Span
Last Post by Suzie999

Ok, now I do not believe the problem lies with Debug.Write().

I tried a MessageBox and the result is the same.

I'm still largely confused though.


I still have no idea why it started today though.

Went back to reading the actual csv source file and the Debug.Write was still not correct.

After amending the read code from file_line_array = File.ReadAllLines(filename); to file_line_array = File.ReadAllLines(filename, Encoding.Default); the issue appears to be resolved.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.