How to parse Shell result(not English language pack/Windows)

Through a shell, I issue a ‘sc’ command to register a windows service and parse the Shell result in DataAvailable event.
On Enligsh Windows, there is no issue. However, in case users use Korean/Japanese language packs, the Shell results return as following.

[SC] OpenSCManager ??? 5:

??? ???.

I need to parse the Shell result correctly.

Do I have to use Encoding method to make it look good?

[quote=222895:@changwon lee]Through a shell, I issue a ‘sc’ command to register a windows service and parse the Shell result in DataAvailable event.
On Enligsh Windows, there is no issue. However, in case users use Korean/Japanese language packs, the Shell results return as following.

[SC] OpenSCManager ??? 5:

???í ???·???.

I need to parse the Shell result correctly.

Do I have to use Encoding method to make it look good?[/quote]

What happens in the Command Prompt ?

[quote=222895:@changwon lee]Through a shell, I issue a ‘sc’ command to register a windows service and parse the Shell result in DataAvailable event.
On Enligsh Windows, there is no issue. However, in case users use Korean/Japanese language packs, the Shell results return as following.

[SC] OpenSCManager ??? 5:

???í ???·???.

I need to parse the Shell result correctly.

Do I have to use Encoding method to make it look good?[/quote]

I suspect this could be UTF-16. Here is what I get with Encodings.UTF16 :
???

Having not practiced Japanese for 30 years and having no knowledge of Korean, I could not see if that made any sense.

Unfortunately, Encoding doesn’t help. I just see weird characters.

By the way, I found some pattern in Shell result so I can check it is normal state or not since there are some numbers in the result.

Thanks.

[quote=223012:@changwon lee]Unfortunately, Encoding doesn’t help. I just see weird characters.

By the way, I found some pattern in Shell result so I can check it is normal state or not since there are some numbers in the result.

Thanks.[/quote]

You did not reply about what the command line prompt display with the same command. How could you fix anything without knowing what the string should be ?

Oh. Sorry.

I have tried below code each, and the textarea results looked as following.

ShellResult = ConvertEncoding(ShellResult, Encodings.WindowsKoreanJohab)
ShellResult = ConvertEncoding(ShellResult, Encodings.UTF18)

[SC] OpenSCManager ???? 5:

???????? ???????·??????.

[quote=223155:@changwon lee]Oh. Sorry.

I have tried below code each, and the textarea results looked as following.

[code]
ShellResult = ConvertEncoding(ShellResult, Encodings.WindowsKoreanJohab)
ShellResult = ConvertEncoding(ShellResult, Encodings.UTF18)

[SC] OpenSCManager ??? 5:

??? ???·???.

[/code][/quote]

Sigh. I am not getting through.

You keep showing the gibberish in Result. We have absolutely no idea about what to expect anyway.

When I ask you to verify what happens in the Command Prompt, I am not talking about the Xojo shell. I am talking about what the Korean Start/Windows System/Command Prompt accessory “Terminal” displays when you issue the same command there.

Here, on a US system, if that accessory is started as administrator (necessary to install a service), I get :

C:\\WINDOWS\\system32>SC create MyService displayname= "MyService" binpath= "C:\\Program Files\\MyService\\MyService.exe" start= auto [SC] CreateService SUCCESS

If the Terminal is not started as administrator, here is the response :

[code][SC] OpenSCManager FAILED 5:

Access is denied.[/code]

I believe that is what you are getting where “FAILED” shows as ??? in your first post. You probably need to find a way to have your app started as administrator in order for SC to work, notwithstanding the encoding issue.