with this code it is working as expected...
So from this point of view no conversion for input needed.
Thanks for your time and discussing this with me.
Code: Select all
EnableExplicit
Global idProg, param$, line$, x
Global *Buffer, ReadLen
Procedure.s ExternalProgram_CP850ToUnicode(*Buffer, Length.i)
DataSection
ExternalProgram_CP850Data:
Data.u $00c7, $00fc, $00e9, $00e2, $00e4, $00e0, $00e5, $00e7
Data.u $00ea, $00eb, $00e8, $00ef, $00ee, $00ec, $00c4, $00c5
Data.u $00c9, $00e6, $00c6, $00f4, $00f6, $00f2, $00fb, $00f9
Data.u $00ff, $00d6, $00dc, $00f8, $00a3, $00d8, $00d7, $0192
Data.u $00e1, $00ed, $00f3, $00fa, $00f1, $00d1, $00aa, $00ba
Data.u $00bf, $00ae, $00ac, $00bd, $00bc, $00a1, $00ab, $00bb
Data.u $2591, $2592, $2593, $2502, $2524, $00c1, $00c2, $00c0
Data.u $00a9, $2563, $2551, $2557, $255d, $00a2, $00a5, $2510
Data.u $2514, $2534, $252c, $251c, $2500, $253c, $00e3, $00c3
Data.u $255a, $2554, $2569, $2566, $2560, $2550, $256c, $00a4
Data.u $00f0, $00d0, $00ca, $00cb, $00c8, $0131, $00cd, $00ce
Data.u $00cf, $2518, $250c, $2588, $2584, $00a6, $00cc, $2580
Data.u $00d3, $00df, $00d4, $00d2, $00f5, $00d5, $00b5, $00fe
Data.u $00de, $00da, $00db, $00d9, $00fd, $00dd, $00af, $00b4
Data.u $00ad, $00b1, $2017, $00be, $00b6, $00a7, $00f7, $00b8
Data.u $00b0, $00a8, $00b7, $00b9, $00b3, $00b2, $25a0, $00a0
EndDataSection
Protected Result$, i.i, Byte.a
Length - 1
For i = 0 To Length
Byte = PeekA(*Buffer + i)
If Byte < $80
Result$ + Chr(Byte)
Else
Result$ + Chr(PeekU(?ExternalProgram_CP850Data + (Byte & $7F) << 1))
EndIf
Next i
ProcedureReturn Result$
EndProcedure
;' different parameter settings ...
param$ = "/?"
param$ = "c:\Temp\Source\FolderWithÄÖÜ c:\Temp\Dest\FolderWithÄÖÜ /S " ;' does the job
;param$ = "c:\Temp\Source\FolderWithÄÖÜ c:\Temp\Dest\FolderWithÄÖÜ /S /L " ;' list only, no action on files and folders
;param$ = "c:\Temp\Source\FolderWithÄÖÜ c:\Temp\Dest\FolderWithÄÖÜ /S /L /quit" ;' robocopy stops after analysing params
*Buffer = AllocateMemory(1024, #PB_Memory_NoClear)
idProg = RunProgram("robocopy.exe", param$, "", #PB_Program_Open|#PB_Program_Read|#PB_Program_Hide)
If IsProgram(idProg)
; Debug "Console Codepage: "
; Debug "AttachConsole = "+AttachConsole(ProgramID(idProg))
; Debug "GetConsoleCP = "+GetConsoleCP_()
; Debug "GetConsoleOutputCP = "+GetConsoleOutputCP_()
; FreeConsole_()
Debug "Start Robocopy Help "
Repeat
While AvailableProgramOutput(idProg)
ReadLen = AvailableProgramOutput(idProg)
If ReadLen > MemorySize(*Buffer)
*Buffer = ReAllocateMemory(*Buffer, ReadLen, #PB_Memory_NoClear)
EndIf
ReadLen = ReadProgramData(idProg, *Buffer, ReadLen)
If ReadLen
line$ = ExternalProgram_CP850ToUnicode(*Buffer, ReadLen)
Debug " '"+line$+"'"
EndIf
Wend
Delay(10)
Until Not ProgramRunning(idProg)
CloseProgram(idProg)
Debug "Done "
EndIf
FreeMemory(*Buffer)