F
F
fierro2019-03-14 14:46:44
Character encoding
fierro, 2019-03-14 14:46:44

C# programming: how to make the Ukrainian character "i" recognized?

For one project, I need to create a program that will process string data. So far, I'm first working with a text file .txt that has a certain number of lines in the Ukrainian language.
Alas, the problem is that the Ukrainian character "i" is not recognized. Instead of them, the console displays the "?" sign, and the program itself processes it incorrectly (that is, when checking a word with the letter "i", the result is not what you need). There are no problems with "є" and "ї".
The code for reading the file is the simplest I have. Here is a fragment from my program (the first line is the most important):

using (StreamReader sr = new StreamReader(path, System.Text.Encoding.Default))
            {
                string line;

                while ((line = sr.ReadLine()) != null)
                {
                    Line x = new Line(line);
                    checklist.Add(x);

                    //Console.WriteLine(line);
                }
            }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2019-03-14
@byte916

Try

using (StreamReader sr = new StreamReader(path, System.Text.Encoding.GetEncoding("koi8-u")))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question