streamwriter and pound character

G

Guest

I want to create a text file with a pound (£) character in it, when i use
StreamWriter class with ASCII (System.Text.Encoding.ASCII) or ANSI
(System.Text.Encoding.Default) encoding the £ (pound) character is either
getting displayed as a ? or as some special character.

It works fine if i use Unicode (System.Text.Encoding.Unicode) encoding, but
i would like my file to be in ANSI format rather than in Unicode format.

Is there any way i can write a £ (pound) character with ANSI
(System.Text.Encoding.Default) encoding? My regional settings are configured
to UK (English).

Any help on this would be greatly appreciated.
 
K

Kevin Spencer

The '£' character is not a part of the ASCII character set. It is part of
the Windows Default ANSI Code Page (1252 - Western European Latin), and is
character A3 (163). As for why it is "displayed" as some other character,
that depends on how you're "displaying" it.

I'm awfully curious as to why you don't want to use Unicode.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top