c# Remove special chars from a File

Posted by jmpena on Stack Overflow See other posts from Stack Overflow or by jmpena
Published on 2010-04-23T15:55:21Z Indexed on 2010/04/23 16:03 UTC
Read the original article Hit count: 371

Hello i have a problem,

im trying to open a textfile and remove all the special chars ñ Ñ ' á í etc...

the file its a Layout that the clients send to me and i parse it to send the file to an AS400 server but i have to remove all special chars.

THE PROBLES IS:

some files with some special chars when i open it in c# it read the special chars and Two different chars and move the entire line one space to the right and then the information that has to be in that position wont be OK.

i take the same file and open it in Notepad and the file is OK but when i open it in WordPad it looks like 2 chars (for just 1 especial char) Example: in the file i have:

"0001 0003JUAN PEÑA33441JPENATEST"

But in c# it shows

"0001 0003JUAN PEï¦A33441JPENATEST"

im using the encondig 1251

any help?

© Stack Overflow or respective owner

Related posts about c#

Related posts about textfiles