1. Wagdy Akeela
  2. PowerBuilder
  3. Tuesday, 7 December 2021 21:35 PM UTC

convert Hexdecimal string to base64 without using blob variable ?

Wagdy Akeela Accepted Answer Pending Moderation
  1. Wednesday, 8 December 2021 19:14 PM UTC
  2. PowerBuilder
  3. # 1

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
  1. Arnd Schmidt
  2. 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))

  1. Helpful
  1. Wagdy Akeela
  2. 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
  1. Helpful
  1. Arnd Schmidt
  2. 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

  1. Helpful
There are no comments made yet.
Wagdy Akeela Accepted Answer Pending Moderation
  1. Wednesday, 8 December 2021 18:41 PM UTC
  2. PowerBuilder
  3. # 2

thanks for your feedback, let check it and i will update you

 

Comment
There are no comments made yet.
Arnd Schmidt Accepted Answer Pending Moderation
  1. Tuesday, 7 December 2021 22:29 PM UTC
  2. PowerBuilder
  3. # 3

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.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.