I have a text file which contains the char ¿
when I use the ReadAllText
function to get the txt file text:
the function changes the char ¿
to ?
How can I get that char? Should I use another function?
Asked
Active
Viewed 554 times
0

Dag Høidahl
- 7,873
- 8
- 53
- 66
-
1Give us the corresponding code please. – C4d Feb 26 '16 at 20:57
-
Have you tried the ReadAllText(path, Encoding)? That might help – anhoppe Feb 26 '16 at 21:38
-
Hi since this is your first post on stack overflow. Please try to follow the guide lines. Please put your code up so we can help you! – Luke Xu Mar 06 '16 at 03:06
3 Answers
0
The file is likely in an encoding the method cannot detect automatically (most encodings cannot be reliably detected anyways). Use the overload that lets you specify an encoding and specify the correct encoding for the file.

Matti Virkkunen
- 63,558
- 9
- 127
- 159
0
You should provide the encoding as second parameter like:
File.ReadAllText("file path", Encoding.UTF8);
Here is the list of encoding.

Shaharyar
- 12,254
- 4
- 46
- 66
0
Problem with encodings
Try to use Encoding.GetEncoding("iso-8859-1")
for spanish characters.
File.ReadAllText("file path", Encoding.GetEncoding("iso-8859-1"));