Hi, I have a problem when I try to get the result of a batch command in a variable, the spanish characters like á or ñ doesn't appear, instead I get junk. I think is something about encoding, but I don't know how to set it in the setInstallerVariableFromScriptOutput action.

The thing is that if I run the batch program in a command line I can see the text perfectly.

Thanks in advance

asked 18 Apr '13, 11:30

Alberto%20Esparza's gravatar image

Alberto Esparza
21224
accept rate: 50%


Finally I got a solution,

Instead of using the WScript.Echo as we have been using for a while, I'm using Set fso = CreateObject ("Scripting.FileSystemObject") Set stdout = fso.GetStandardStream (1) stdout.WriteLine "á é í ó ú ñ"

We use a cscript /nologo command to run it and we get the text just fine.

Thanks anyway for your help and if you see anything that we can improve, I'll be very thankful. Regards.

link

answered 22 Apr '13, 04:30

Alberto%20Esparza's gravatar image

Alberto Esparza
21224
accept rate: 50%

Could you let us know which platform is this happening on and what exact command are you running? And what is its default encoding? Some commands print in unicode when printing to console or to a file, but write ANSI when the stdout/stderr is redirected to another program (such as InstallBuilder).

One option is to redirect output to a file in the .bat file and use <readFile> action, which allows specifying charset encoding.

link

answered 19 Apr '13, 09:01

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

Hi, It happens in a Windows XP Professional, in a Windows 2008 and in a Windows 7 as far as I have tried it. What I'm doing is calling a .bat file from InstallBuilder and in that .bat file I'm calling a vbs script that does some actions and writes back a result. Is that result what gets messes up. I've builded a simple poc code that shows it

<project> <shortname>POC</shortname> <fullname>POC</fullname> <version>1.0.0</version> <installerfilename>POC.exe</installerfilename> <defaultlanguage>auto</defaultlanguage> <languageselectionstyle>onlyNativeNames</languageselectionstyle> <initializationactionlist> <writefile> <path>${installer_directory}\poc.vbs</path> <text>WScript.Echo "á é í ó ú ñ"</text> </writefile> <writefile> <path>${installer_directory}\poc.bat</path> <text>@cscript /nologo poc.vbs</text> </writefile> <setinstallervariablefromscriptoutput> <exec>${installer_directory}\poc.bat</exec> <execargs></execargs> <name>prueba</name> </setinstallervariablefromscriptoutput> <showinfo> <text>${prueba}</text> </showinfo> </initializationactionlist> <allowedlanguages>es</allowedlanguages> <createuninstaller>0</createuninstaller> <createwindowsarpentry>0</createwindowsarpentry> <enablerollback>1</enablerollback> <enabletimestamp>1</enabletimestamp> <height>450</height> <outputdirectory>.</outputdirectory> <productdisplayname></productdisplayname> <requireinstallationbyrootuser>1</requireinstallationbyrootuser> <saverelativepaths>1</saverelativepaths> <startmenugroupname></startmenugroupname> <style>custom</style> <uninstallationlogfile>${windows_folder_desktopdirectory}\Uninstall_${product_fullname}_log.txt</uninstallationlogfile> <vendor>POC</vendor> <width>640</width> <windows64bitmode>1</windows64bitmode> <windowsarpregistryprefix></windowsarpregistryprefix> <windowssoftwareregistryprefix></windowssoftwareregistryprefix> </project>

In the initialization actions I write both the vbs and the bat scripts and then run the bat script with the setInstallerVariableFromScriptOutput action, the script run manually shows the string "á é í ó ú ñ" but when run by InstallBuilder shows a bunch of weird characters.

Thanks

link

answered 22 Apr '13, 02:57

Alberto%20Esparza's gravatar image

Alberto Esparza
21224
accept rate: 50%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×41
×15
×10
×4

Asked: 18 Apr '13, 11:30

Seen: 2,576 times

Last updated: 22 Apr '13, 04:30