I have a problem with some VBS script that displays Unicode characters.
I want to run the script via nsExec::ExecToLog to capture its output.
To force unicode output from cscript I use /U command. It should show output text
in Nsis installer log... it does not, why?
Here is a simple, example code:
Test_Unicode.nsi file:
Unicode True
!include "MUI2.nsh"
!include "nsdialogs.nsh"
!include "WordFunc.nsh"
!include "FileFunc.nsh"
!include "WinVer.nsh"
!include "LogicLib.nsh"
!include "x64.nsh"
;--------------------------------
Name "Test_Unicode"
OutFile "Test_Unicode.exe"
RequestExecutionLevel "admin"
XPStyle on
SetDatablockOptimize on
SetCompressor /FINAL /SOLID LZMA
ShowInstDetails show
!insertmacro MUI_PAGE_INSTFILES
;--------------------------------
!define MUI_LANGDLL_ALLLANGUAGES
!insertmacro MUI_RESERVEFILE_LANGDLL
; Polish
!insertmacro MUI_LANGUAGE "Polish"
; English
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
ShowInstDetails Show
Function .oninit
InitPluginsDir
File "/oname=$PLUGINSDIR\VBS_Unicode.vbs" "VBS_Unicode.vbs"
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Section "Run_VBS_Test_File" SecDummy2
${If} $Language = "1045" ;Polish
${If} ${AtLeastWin7}
DetailPrint ""
; Unicode
nsExec::ExecToLog '"$SYSDIR\cscript.exe" /nologo /T:120 /U "$PLUGINSDIR\VBS_Unicode.vbs"'
Pop $0
DetailPrint "Return value: $0"
${EndIf}
${Else}
MessageBox MB_OK "Please, run in Polish language, to see Unicode characters"
${EndIf}
SectionEnd
Section -Post
SetAutoClose false
SectionEnd Example VBS file, VBS_Unicode.vbs:
WScript.Echo "Przykładowy tekst. ŚĆĘĄÓŁŃ"
WScript.Echo "Above means: Example text: Unicode letters" If I remove /U command, NSIS installer displays output text (however, incorrectly). When I use /U it doesn't show anything (I thought it should display correct unicode text).This is just simple example, as my vbs script is complicated and adopted by me (my VB skills are very poor, so forgive me if I am totally wrong...)
Maybe you have some idea how to capture unicode text from cscript?
-Pawel