0

For example, there is a path (English, Ukrainian, Armenian and Greek) that I pass to the console with any command.

I am passing the given string through C#. Here is an example:

Process p = new Process();

p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.StandardInputEncoding = Encoding.UTF8;

p.Start();

using (StreamWriter sw = p.StandardInput)
{
    if (sw.BaseStream.CanWrite)
    {
        sw.WriteLine(@"dir D:\A1g0r\Project Visual Studio\Проект\Նախագիծ\Εργο");
    }
}

The problem arises that Unicode does not help or I can specify the encoding for one language + English, which may not be enough. But we don't know what folder names users have. Therefore, the question arises from this, how to make it work multilingually? I will clarify that I can have many commands that I execute in the console

I googled, read articles, and of course turned to ChatGPT, but I didn’t even find an approximate answer

Compo
  • 36,585
  • 5
  • 27
  • 39
A1g0r
  • 3
  • 1
  • 1
  • Can you get the system's language your console application is running on and then use that to decide what you need? [Get current language in CultureInfo](https://stackoverflow.com/questions/4208244/get-current-language-in-cultureinfo) – quaabaam May 15 '23 at 17:28
  • @quaabaam if it starts to support suppose Armenian, then what to do with Ukrainian or any other language. Moreover, this method may not be effective at all if the system is in English, but there are directories in different languages – A1g0r May 15 '23 at 18:59
  • Switch to [UTF-8 Everywhere](https://utf8everywhere.org/); example: https://stackoverflow.com/a/42046711/3439404 – JosefZ May 16 '23 at 13:45

0 Answers0