best way to decode base64 unicode string?

26 views
Skip to first unread message

Traktor

unread,
Jun 2, 2021, 7:42:21 PMJun 2
to innosetup
Like in topic, what's the smartest method?

Gavin Lambert

unread,
Jun 2, 2021, 8:03:04 PMJun 2
to inno...@googlegroups.com
On 3/06/2021 11:42 am, Traktor wrote:
> Like in topic, what's the smartest method?

Depends what you mean by "smartest".

You could call the WinAPI CryptStringToBinary function [1], but that
requires some familiarity with how to deal with passing string buffers
between Inno and external libraries.

Another option is to implement the Base64 decoding algorithm directly in
the Pascal script; it's not overly complicated and you can probably find
many examples online.

Either way, you'll also require knowledge of the encoding of the result
(it needs to be treated differently if it's UTF-8, UTF-16, or actual
binary data).

[1]:
https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptstringtobinaryw
Reply all
Reply to author
Forward
0 new messages