we are trying to convert a unicode string to hex using the following code:
decimalNumber = STRTOCHAR (StringValue)
num1 = decimalNumber /16;
num2 = decimalNumber – (num1*16)
sResult = HexEquivalent(num1) + HexEquivalent(num2)
However! the characters '80'-'9F' are not supported in unicode. The original string that is given to IS is actually a string in the Windows Western character set. but when i use the STRTOCHAR it is assuming the string is in unicode and is converting it incorrectly to decimal - since some of the characters do not exist in Unicode. Is there any way to convert the string we are reading in directly into Hex? Since IS is assuming the string should be in Unicode i am getting garbage when i try to convert it back to hex if the character falls in the 80-9F range.
I looked into StrToNumHex but it only handles 1-9 and A-F so this wont convert unicode to hex
the definition of STRING in IS2010 says is is an array of Unicode characters. the string we are reading in is in Windows:Western. So this assumption by Installshield causes a problem from the very beginning. how should i handle a string that is in unicode, and convert it back to its original hex value if Installshield has converted it to the incorrect character set in the first place? is there any function in IS that can handle the conversion of the Windows:western character set?
I also found some code along the way on the Flexera forum that suggested the use of : Sprintf(szHexa,"%lX",szCar[i]);
This did not seem to work. The result was a 7 digit hex number for a one character string value. For instance i put the value 'Œ' as 'szCar' and then the result for szHera was "1F29BE0"
We have been stumped on this for a week now about how to handle a string that is passed in, in the Windows western character set, and being able to correctly convert it to hex. Please let me know if you have any suggestions. is there anything to directly convert this windows western string to hex?
thanks!
Alicia
Edited by aclayto87, 17 November 2010 - 20:51.