OB2 can't Base64toUTF but OB1 can

Hello, im converting my codes to OB2 and for some unknow reason OB2 cant decode the Base64 output here is the part of the code:

OB2

>> Cap_Titulo-Mail (QueryJsonToken) <<

Parsed value: Tk9WQVpPTiAtIE1lcmNhZG8gZGEgQW1hem9u

Assigned value to variable 'TTL'

[Executing block Decode_TTL] FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

but in OB1 works fine !

OB1

<β€” Executing Block PARSE β€”>
Parsed variable | Name: TTL | Value: Tk9WQVpPTiAtIE1lcmNhZG8gZGEgQW1hem9u

<β€” Executing Block FUNCTION β€”>
Executed function Base64Decode on input Tk9WQVpPTiAtIE1lcmNhZG8gZGEgQW1hem9u with outcome NOVAZON - Mercado da Amazon

Parsed variable | Name: Pesquisa | Value: NOVAZON - Mercado da Amazon

can someone help me out identify what is causing this error in OB2?

thanks !

Hello Mario,
It is possible to do this with OB2 too :

BLOCK:ConstantString
  value = "Tk9WQVpPTiAtIE1lcmNhZG8gZGEgQW1hem9u"
  => VAR @Base64
ENDBLOCK
byte[] step_one = Convert.FromBase64String(Base64);
string step_two = Encoding.UTF8.GetString(step_one);

Capture

Or you know there’s an even easier way, just use Base64 => UTF8 instead of Base64Decode

BLOCK:Base64ToUTF8
  input = "Tk9WQVpPTiAtIE1lcmNhZG8gZGEgQW1hem9u"
  => VAR @base64ToUTF8Output
ENDBLOCK
1 Like