Archive: Return unicode of a character


Return unicode of a character
Is there a function in NSIS that can return the unicode of a certain character? Something similar to charCodeAt() in JavaScript?


You can use the System plug-in to convert strings into Unicode. There are many ways to do that, even with that plug-in. If you provide a little more details about what exactly you're trying to do, I can show you the best solution for the problem.


Edit: I just need to loop on every character in a string, obtain its unicode value, and do some operation on it.


Build a Unicode string and read it 2 bytes at a time.

System::Call "*(&w1024 'hello')i.r0"
StrCpy $1 $0
System::Call "*$0(&i2.r2)"
${While} $2 != 0
DetailPrint $2
IntOp $0 $0 + 2
System::Call "*$0(&i2.r2)"
${EndWhile}
System::Free $1

Excellent... Exactly what I needed. Thank you!