VBS parse issues related to culture aware API
We have a WiX installation that we use to deploy our applications, one of the actions in the WiX template is to run a VBS that does some registry queries to fetch a major.minor version that was written by another application and see that its in the valid range.
Everything was working great UNTIL this installation was ran on French and then we got failure because of parse error
The registry value is always written as “[major].[minor]” by some other component (E.g. US format) and our code simply did CDBL on that value.
the issue that we forgot is that CDBL is culture aware meaning that in other languages e.g. French the decimal delimiter is “,” rather than “.”
For that i have created a very simple function like so:
originalLocale = SetLocale("en-US")
dbl = Cdbl(dbl)
parseUSDouble = dbl
The reason i am returning to original locale and not to Current system locale is because someone might set the locale to different that the current (don't know why – but could be)
There is a very important basic issue to remember to always know who is the owner of INPUT that you get and how it was serialized
Funny thing that i couldn’t find too much information on it while trying to troubleshoot , well now you can :)