convert Hexdecimal string to base64 without using blob variable ?
- You are here:
- Home
- Q&A
- Q&A
- PowerBuilder
- convert Hexdecimal string to base64 without using blob variable
- Wagdy Akeela
- PowerBuilder
- Tuesday, 7 December 2021 21:35 PM UTC
- Tuesday, 7 December 2021 22:29 PM UTC
- PowerBuilder
- # 1
Hi Wagdy Akeela,
at least you need the Blob() function and yes, that will produce a kind of a blob variable and it's space needs to be allocated during the call.
String ls_hexValues
String ls_Base64Str
String ls_hexCheck
ls_hexvalues = "01234567890ABCDEF"
CoderObject lnv_CoderObject
lnv_CoderObject = Create CoderObject
// Encode
ls_Base64Str = lnv_CoderObject.Base64Encode(Blob(ls_hexvalues , EncodingANSI!))
// .. Decode
ls_hexCheck = String ( lnv_CoderObject.Base64Decode(ls_Base64Str), EncodingANSI! )
hth
Arnd
Comment
There are no comments made yet.
- Wednesday, 8 December 2021 18:41 PM UTC
- PowerBuilder
- # 2
thanks for your feedback, let check it and i will update you
Comment
There are no comments made yet.
- Wednesday, 8 December 2021 19:14 PM UTC
- PowerBuilder
- # 3
dear
this command line
ls_Base64Str = lnv_CoderObject.Base64Encode(Blob(ls_hexvalues , EncodingANSI!))
is not working correctly, so the ls_hexvalue varible already converted to Blob (binarry vairlable ) by using Blob command inside lnv_codeerobject,base64encode command as the above line, i want encoded base64 without use Blob command, how ?
regards
Comment
- Arnd Schmidt
- Thursday, 9 December 2021 19:25 PM UTC
OK, but each String has some encoding in PowerBuilder.
If you are using a normal PowerBuilder String (UTF16-LE) then you can use the Blob function without any Encoding Enumeration.
That leads to:
ls_Base64Str = lnv_CoderObject.Base64Encode(Blob(ls_yourString))
If you are using a normal PowerBuilder String (UTF16-LE) then you can use the Blob function without any Encoding Enumeration.
That leads to:
ls_Base64Str = lnv_CoderObject.Base64Encode(Blob(ls_yourString))
-
Helpful Loading... Helpful 0
- Wagdy Akeela
- Thursday, 9 December 2021 19:38 PM UTC
Maybe my words is not clear, i want encode base64 without using blob, blob is convert the string to binarry/byte , i want encode from string to base64, if there is any way please let me now like another progamming languge (defi or JAVA).
thanks
thanks
-
Helpful Loading... Helpful 0
- Arnd Schmidt
- Thursday, 9 December 2021 20:36 PM UTC
OK, so you do not trust the blob function. sigh... How about writing that blob into a file and take a look at the hex values?
Or try the crypto API Example from Roland Smith's website.
https://www.topwizprogramming.com/freecode_cryptoapi.html.
This offers an encoding for a string: => of_encode64 (string as_message) returns string
hth
Arnd
Or try the crypto API Example from Roland Smith's website.
https://www.topwizprogramming.com/freecode_cryptoapi.html.
This offers an encoding for a string: => of_encode64 (string as_message) returns string
hth
Arnd
-
Helpful Loading... Helpful 0
There are no comments made yet.
- Page :
- 1
There are no replies made for this question yet.
However, you are not allowed to reply to this question.
However, you are not allowed to reply to this question.
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here. Register Here »