I am retrieving a base-64 encoded byte array and need to return its string value. Looking over previous posts, I found that this could be done with hex conversion. Am I on the right path?
Thanks for any help.
This topic has been locked.
3 replies Latest Post - 2012-11-29T22:38:05Z by HermannSW
Pinned topic How to obtain the string value of an encoded byte array
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-11-29T22:38:05Z at 2012-11-29T22:38:05Z by HermannSW
Daviiid 270004UFEC213 Posts
SystemAdmin 110000D4XK6772 Posts
HermannSW 2700006U542740 PostsACCEPTED ANSWER
Re: How to obtain the string value of an encoded byte array2012-11-29T22:38:05Z in response to SystemAdminHi Cindy,
your original question was on how to determine the "string value" of a base64 encoded string.
David answered that question.
Your "dp:radix-convert(_, 64, 16)" solution does return the "hexadecimally encoded string".
If that is what you really want, fine.
But be aware that you will loose any leading 0x00 bytes by this (radix-convert is a "number" function).
So if you do not want that, you would need a solution like this:
substring(dp:radix-convert(concat( '8AAA', _),64,16),7)
(it prepends base64('F00000')='8AAA', converts, and then just strips the first 6 prepended characters)