C:\...\>ping something
Output is:
Ping-Anforderung konnte Host "something" nicht finden. šberprfen Sie den Namen, und versuchen Sie es erneut.
Output should be:
Ping-Anforderung konnte Host "something" nicht finden. überprüfen Sie den Namen, und versuchen Sie es erneut.
This works correctly from the command line.
System.Diagnostics.Process - Encoding output/Code page
Does anyone know how to get localized/properly encoded output from a System.Diagnostics.Process? See example below.
I tried toying around with the StartInfo.Encoding-Property to no avail. Google isn't really helpful either.
I think I have found a (partial) solution:
This will change the encoding to the codepage used by the specific language version of windows.
Does anyone know if this will work in all cases? The command line seems to "speak" the language of the operating system not paying attention to the users language and regional settings. So I should get away with using the OEMCodePage?
I tried using the ".ANSICodePage", the description suggests that this will return the code page used by the current culture. However, even though the culture is set to "de-DE" it gives me CP 1252 (US) instead of CP 850 (German) as I would expect.
ProcessStartInfo psi = new ProcessStartInfo();psi.StandardOutputEncoding = Encoding.GetEncoding(System.Globalization.CultureInfo.CurrentUICulture.TextInfo.OEMCodePage);
This will change the encoding to the codepage used by the specific language version of windows.
Does anyone know if this will work in all cases? The command line seems to "speak" the language of the operating system not paying attention to the users language and regional settings. So I should get away with using the OEMCodePage?
I tried using the ".ANSICodePage", the description suggests that this will return the code page used by the current culture. However, even though the culture is set to "de-DE" it gives me CP 1252 (US) instead of CP 850 (German) as I would expect.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement