Dear Friends,

In my C# desktop application, I get the startup path from
Application.StartupPath.Then my program creates a batch file, which
changes the directory (with cd) to the above startup path (since
sometimes it runs batches which changes the current directory).
In English windows it works great. But on Spanish Windows, my app's
startuppath contains accent. So when I view the batch file I created,
it has invalid characters where accent was before.
I create the batch file in the following way:

StreamWriter sw = new StreamWriter("a.bat");
sw.WriteLine("cd " + Application.StartupPath);
sw.Close();

As I described, in a.bat I'll find that path corrupted where the
accent originally appears.
Note that in MSDN documentation, it says that StreamWriter always uses
UTF-8.

How can I avoid this problem?

Please help, it's very urgent.

Thanks deeply,
Ohad.

Reply via email to