£ sign converted to [] (square sign) when importing

ninjaimp

Well-known member
Joined
Jun 13, 2007
Messages
80
Programming Experience
1-3
Hi

Im importing text from a .txt file using streamreader and when it reads in a £ sign it converts it to the square symbol for a unknown character!

If i put in a $ sign it imports it correctly!

I wondered if anyone had any suggestions?
 
StreamReader uses UTF8 encoding by default, and the text you're reading was obviously encoded differently. With the constructor you can specify which encoding the reader will use, if you don't know the source encoding try your systems default, eg System.Text.Encoding.Default.
 
Back
Top