VB Script file encoding - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

virgil
Posts: 22
Joined: Sat Mar 19, 2011 1:40 am

VB Script file encoding

When a VB Script is added as a custom action, it will only be executed if the script file is encoded in ASCII or UTF-8. If the script file is encoded in UTF-16 (MBCS) it does not get executed. Is this a limitation of AI ? I'm able to run a script encoded as UTF-16 from a command prompt successfully.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: VB Script file encoding

Hi,

I didn't found any specific docs on this subject from Microsoft, so I am not 100% sure, but here is what I think that happens. If you have the VBScript custom action added as "New attached custom action" then
the script file will be stored in the "Binary" table from the MSI. This table stores its content in ANSI, you can see this by exporting the content of a row.

You can try to add the custom action as a "New installed custom action", this will require to add the file in the Files and Folders page, along with your application's files. This file should
have the encoding UTF-16, the one you said it works only from a command prompt.

Also, do you have any specific reasons to why you want to use this specific encoding?

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
virgil
Posts: 22
Joined: Sat Mar 19, 2011 1:40 am

Re: VB Script file encoding

Bogdan wrote:...Also, do you have any specific reasons to why you want to use this specific encoding?
Thanks for the reply. I too researched the issue thoroughly and concluded it must be an AI limitation. It would be nice if AI supported this encoding.

The reason for needing UTF-16 support is I'm setting the value of a custom session property as a literal string based on an OS setting. This session property is then stored and later displayed in a UI, so it needs to be fully Unicode compliant for foreign language support.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: VB Script file encoding

Hi,

I shall investigate further more on this subject, as I said until now I could not find any specific documentation.

Until then another solution for you would be to use a Win32 DLL, created after the following example. Also, the MSI should be to support Unicode characters, from Media page, MSI tab.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
virgil
Posts: 22
Joined: Sat Mar 19, 2011 1:40 am

Re: VB Script file encoding

In the end, the Win32 dll method is how I resolved the issue. Thanks for looking in to it further, great support is one of the major reason I use AI.

Return to “Common Problems”