How to Decode base64 string value using uipath?

Hi Team ,

I have python encoded base64 value while trying to decode with some python/C# script but not getting the exact value .Can someone please help on this.

Encoded value:LDwHASBuLmEHGgBuBGF0XwUmMAUCMAl0TQk2IFcsIDE1ICgoAAQJIAcPUDh1bTIiQDZhRFsGIG1wXQA+PHN0eWxlPiwiMiIAAzB+cDNSVhEiOVMAPGJxNwtgfwQQGgAAIjYzdWDnp69IaXQgUHRlXTNwPiw8UzB0cyBQZB8iLyRPXyZvJ38oME8sPABTAGEAbQB1AGUAbAAuAEwAYQBuAGUAQABsAGgAaAAuAGMAbwBtAD4sPABtAGEAaQBsAHQAbwA6AFMAYQBtAHUAZQBsAC4AbABhAG4AZQBAAGwAaABoAC4AYwBvAG0APiw8AHIAbwBiAHMAbwBuAC4AcABlAHAAZQBAAGwAaABoAC4AYwBvAG0APiw8AHIAbwBiAHMAbwBuAC4AcABlAHAAZQBAAGwAaABoAC4AYwBvAG0APiw8AEoAbwBhAG4AbgBpAGUALgBTAHUAbgBMAGUAdQBuAGcAQABsAGgAaAAuAGMAbwBtAD4sPABTAGEAbQB1AGUAbAAuAEwAYQBuAGUAQABsAGgAaAAuAGMAbwBtAD4ALAAgAFIAbwBiAHMAbwBuACAAUABFAFAARQAgADwAcgBvAGIAcwBvAG4ALgBwAGUAcABlAEAAbABoAGgALgBjAG8AbQA+LDwGAAAAQAAAAAMAAAAfAD0GAAAADgAAAAMAAAAfAD4sAwAAAwAALgMAAC8DAAAwAwAAMQMAADIDAAAzAwAANAMAADUDAAA2AwAANwMAADgDAAA5AwAAOgMAADsDAAA8AwAAPQMAAD4sPGUFAgFOAkAAAgEIBCAQABAIQCAAAAQCAAIBCAQgEEAAQCAAAAQCEAgACAQgEEAAAgEIBAAEAnM+

Script:
System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(base64String))
Result:
,<a n.aa�nat_&00 tM 6 W, 15 ((� aP8um2"@6aD[ mp]�>,“2"�0~p3RV"9S�<bq7��"63u积Hit Pte]3p>,<S0ts Pd”/$O_&o’(0O,<�S�a�m�u�e�l�.�L�a�n�e�@�l�h�h�.�c�o�m�>,<�m�a�i�l�t�o�:�S�a�m�u�e�l�.�l�a�n�e�@�l�h�h�.�c�o�m�>,<�r�o�b�s�o�n�.�p�e�p�e�@�l�h�h�.�c�o�m�>,<�r�o�b�s�o�n�.�p�e�p�e�@�l�h�h�.�c�o�m�>,<�J�o�a�n�n�i�e�.�S�u�n�L�e�u�n�g�@�l�h�h�.�c�o�m�>,<�S�a�m�u�e�l�.�L�a�n�e�@�l�h�h�.�c�o�m�>�,� �R�o�b�s�o�n� �P�E�P�E� �<�r�o�b�s�o�n�.�p�e�p�e�@�l�h�h�.�c�o�m�>,<���@�������=����������>,����.��/��0��1��2��3��4��5��6��7��8��9��:��;��<��=��>,<eN@� �@ ��� @�@ ��� @��s>

Need help on this how can we can do it in UiPath .

Regards ,
Suresh.T

@Thumu_Suresh

Did you use any different encoding?

Cheers

NO ,I have Base64 value which got it from python script .

Hi,

Do you have expected output (is it string?)

Regards,

Yes Yoichi.

Hi,

Can you share it?

Regards,

In that string we have email id’s .I’m not sure weather we can share that Yoichi.
Sorry for that.

Hi,

All right. I also think sensitive data should not be uploaded.

I decoded the above base64 data to byte array and it’s 0x2C,0x3C,0x07,0x01…
If your string consists of ASCII characters, it does not match your string because there is speciall character 0x07, 0x01 etc.

So can you try to review input string and logic for convert to Base64 in the python script?

Regards,

Thanks for your suggestion!! I will get new input string .Can you please share me the script how to decode Base64 in python using UiPath please.
And also help needed from you…
I have a value 2456.856787 in this value i need only 2456.85 remaining value we need remove after dot i need only two digits .can you help on that.
Thanks…
Regads,
Suresh.T

Hi,

System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(base64String))

Your expression seems good if it’s UTF-8 encoding.

I have a value 2456.856787 in this value i need only 2456.85 remaining value we need remove after dot i need only two digits .

The following expression will work, for example.

System.Text.RegularExpressions.Regex.Match(yourString,"\d+\.\d{2}")

Regards,

2 Likes

Did you get your answer? I’m in a similar situation.

Do you need to encode to or decode from base64?

Using Convert.ToBase64String(), I have a base64 string of binary file (.tif) and would like to create a PDF from it. How do I do that?