Encoding.Default uses the system's current ANSI code page. If a character
cannot be represented using this code page (as seems to be the case here),
you end up with a question mark. To make sure that you can accurately
represent all characters, you should use Encoding.UTF8 or Encoding.Unicode.
--
Kai Brinkmann [MSFT]
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"MrNobody" <(E-Mail Removed)> wrote in message
news:A48992B7-AAF5-4F74-BAD7-(E-Mail Removed)...
> OK I tried Encoding.Default and it loaded the characters without a
> problem,
> but then when I tried to write the file using Encoding.Default it put
> those
> question marks in the file (I viewed the file with Word and Excel)
>
> "Mattias Sjögren" wrote:
>
>>
>> >using (StreamReader sr = new StreamReader(file.OpenRead(),
>> >Encoding.ASCIi)) {
>> [...]
>> >what am I doing wrong?
>>
>> You're using the ASCII encoding when reading the file, which doesn't
>> support these characters. You have to use an encoding that matches how
>> the file was originally written, most likely Encoding.Default or UTF8.
>>
>>
>>
>> Mattias
>>
>> --
>> Mattias Sjögren [MVP] mattias @ mvps.org
>> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
>> Please reply only to the newsgroup.
>>