How to encode shell command

As you can see, I use awk utility for parsing and an input file exists in a Windows special directory.
This system locale is Korean characters, when I run a shell to run the command, I got an error saying ‘No such file directory’.

The Korean part is broken in the error message.

getRepMasterConfigForPROD(Execute): "C:\\Program Files (x86)\\Utilities"\\awk.exe  -f  "C:\\Program Files (x86)\\Parsing"\\REP_CONFIG_MASTER_PROD.awk C:\\Users\\???\\AppData\\Roaming\\main_SSHResultFile_REP_CONFIG_MASTER_PROD

getRepMasterConfigForPROD(ShellResult): awk: fatal: cannot open file `C:\\Users\\?¥?????¢É\\AppData\\Roaming\\main_SSHResultFile_REP_CONFIG_MASTER_PROD' for reading (No such file or directory)

Can you let me know if I should do any ‘encoding’(UTF8?) the command in this environment?
This application should support international locale so I believe I should use UTF8 if I need to encode.

Thanks in advance.

Code:

  Dim Documents As FolderItem = SpecialFolder.ApplicationData
  Dim SpecialTempFolder As String
  SpecialTempFolder = Documents.NativePath + "main_"
  
userCmd_awk     =  AWK + InstallDirectory + awkDirectory + "REP_CONFIG_MASTER_PROD.awk " + SpecialTempFolder + "SSHResultFile_REP_CONFIG_MASTER_PROD"
'userCmd_final = userCmd_awk.ConvertEncoding( Encodings.WindowsANSI ) 
userCmd_final = userCmd_awk
		
ProdShell.Execute   userCmd_final
Logging("getRepMasterConfigForPROD(Execute): "+userCmd_final)
ShellResult = Trim(ProdShell.Result)
Logging("MBS_getRepMasterConfigForPROD(ShellResult): "+ShellResult)

Result:

getRepMasterConfigForPROD(Execute): "C:\\Program Files (x86)\\Utilities"\\awk.exe  -f  "C:\\Program Files (x86)\\Parsing"\\REP_CONFIG_MASTER_PROD.awk C:\\Users\\???\\AppData\\Roaming\\main_SSHResultFile_REP_CONFIG_MASTER_PROD

getRepMasterConfigForPROD(ShellResult): awk: fatal: cannot open file `C:\\Users\\?¥?????¢É\\AppData\\Roaming\\main_SSHResultFile_REP_CONFIG_MASTER_PROD' for reading (No such file or directory)

'userCmd_final = userCmd_awk.ConvertEncoding( Encodings.WindowsANSI )
userCmd_final = userCmd_awk

<<<<<<<<<<<<<<<<<<< right here
userCmd_final = DefineEncoding(userCmd_final, nil)
<<<<<<<<<<<<<<<<<<<<<<<<

ProdShell.Execute userCmd_final

Sorry to say that I got the same issue.

well thats definitely not expected

No need to run below command?
userCmd_awk.ConvertEncoding

But still same issue.

This might sound odd BUT …
What if you use a shell in mode 2 and use Write instead of execute
see http://documentation.xojo.com/index.php/Shell.Mode
The example there is basically using a shell in mode 2

I might try the mode 2 but I think I should also implement Timer to check the shell result.
There are lots of shell execution in my app, so it could make it very complex.

Below is the sample code to reproduce this issue.
As you know, in case there are Korean/Japanese/Chinese characters in the path of SpecialFolder.ApplicationDat, userCmd(Shell command) looks good but I got shell error saying it can’t find the path, actually it seems that Shell can’t recognize the multibyte characters. That is the problem.

  Dim Documents As FolderItem = SpecialFolder.ApplicationData
  Dim SpecialTempFolder As String
  SpecialTempFolder = Documents.NativePath 
  
  Dim ProdShell As New Shell
  Dim userCmd as string
  ProdShell.mode = 0   'Sync
  ProdShell.TimeOut = 10000
  
  dim folderEncoding as string
  'folderEncoding = DefineEncoding(SpecialTempFolder, nil)
  
  userCmd    =  "cd " + SpecialTempFolder 
  'userCmd = userCmd.ConvertEncoding( Encodings.WindowsANSI )
  'userCmd = DefineEncoding(userCmd, nil)
  
  ProdShell.Execute   userCmd
  msgbox("Shell Command: " + userCmd)
  msgbox("Shell Result: " + ProdShell.Result)