Highlighted
Super Contributor.
Super Contributor.
3029 views

Convert String Base64

Jump to solution

I have a Base64 string how do I convert to text.

PENGZT48aW5mQ0ZlIElkPSJDRmUzNTE1MTEwODcyMzIxODAwMDE4NjU5OTAwMDA0ODEwMDAwMDQwNDEzNzc1NSIgdmVyc2FvPSIwLjA2IiB2ZXJzYW9EYWRvc0VudD0iMC4wNiIgdmVyc2FvU0I9IjAxMDAwMCI+PGlkZT48Y1VGPjM1PC9jVUY+PGNORj40MTM3NzU8L2NORj48bW9kPjU5PC9tb2Q+PG5zZXJpZVNBVD45MDAwMDQ4MTA8L25zZXJpZVNBVD48bkNGZT4wMDAwNDA8L25DRmU+PGRFbWk+MjAxNTExMTI8L2RFbWk+PGhFbWk+MTYyNTU1PC9oRW1pPjxjRFY+NTwvY0RWPjx0cEFtYj4yPC90cEFtYj48Q05QSj4xNjcxNjExNDAwMDE3MjwvQ05QSj48c2lnbkFDPlNHUi1TQVQgU0lTVEVNQSBERSBHRVNUQU8gRSBSRVRBR1VBUkRBIERPIFNBVDwvc2lnbkFDPjxhc3NpbmF0dXJhUVJDT0RFPnBocUY1SHNQQnpTM2I5TEN2amhocTU4SXI0K2pMN0V6NFlPeGVlVVBCTG9RK0ttU29jblZsQ1lYQ0poQVFzWmJRZnE2VFB1U3NlSkRxYVdhOWJrMUV4TURsT1h6OWhLd3RHWWpsWEkwSWpSbmVNaEhUb2Y0dFVVcW4xbkNwd3ZYcndJOTZoRTJyc1hwZVRzOWd6cUZlRURIbVIwZ2kyQXJCZ3dCZ1RmbHdicDdhQS82cXlOVlkwczlvRGVRQ3hJVlNnQ0F4NXNhYXViWlhxMzhacU55OVdwSXM1Zjh5UjQ1Y1pwdVhST1JOaVhRNWdRb3RUMU5Yb1dtamN0NTkrMTJmWU1GZVRrMnUxNGN6R3g3cGhIVTdESnBDRmtmUXh6SVZuOHJxN1MxdFBwd0ZXaytQeGkvZEovMTFxeThpaHEzamlnVlc3NEZ3cFM2VzhmTCs4aTRGdz09PC9hc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uUVBxQkdSMDlDZ1N3WldIV2RNTy9tNUJiNU0xb3BmYW9jSWdGeWIyQVluWTVjdU5HNlR6d2MxWGMrRm52d0cwVGQ2Q0swWVBiUDc3Rlc0WTJybGF5SHFWdUhpOFI5TGUwcE5CVW11Ynp3RExnbkZrVEY0amhzQmlaZzl1UjdCc0RsbFFMaURrSCtHRkVST0laLytxdzlzTmJxaVpURTY1UTUwSkFDSFI4ZVlWQ3Y5VHIvdEhkUktvMVF3K1FFWGNhN2Y4NXF0KytUcmhaUnpqSDFaeGdrN0FVZ2tEd2xENDQvT1lKTGlTT0xNM1pDV1dQZzZJMkZUWnRkR21IMGJDdVhwbFNKZUZGc1RkTDBxRUxMb1QyOG5jR1ZkVkwyMFVRZVZyT2hnMFFjWFlUeU1zcGxuYTlwem94UEM1OVZFVGY3Z3EyQUhEVUlBVjh3VmdQTk5ZcXBma1JIeERIaHJpaWNvU0sxREhKc1NlSll5MzR5K0ZiajNxejlDWDI5S0FrK3VxcUlwRkRuSmVXZE02elAyTDFRWTkrMGt3eHFPSkRPTmxJaGlCc2h4UlcvUmxoK0MxbU9teDIrOEJmbnpmd0xKejB1Yk84QWVaTGtjTW40LzNRYTVCTGNNYW1MUnRtRncvRVVML3k0bFFUUnJMbzNrWGEyU3ZKeXJ1TndGdVUya0hjdk40WXpmeHZsakJLNVZjMStKZkhnbm91WHNXTEVjcTJuMjM2aDwvWDUwOUNlcnRpZmljYXRlPjwvWDUwOURhdGE+PC9LZXlJbmZvPjwvU2lnbmF0dXJlPjwvQ0ZlPg==

I tried to ToBase64String instruction but do not know the syntax.

Thank you.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

RE: Convert String Base64

Jump to solution

try this:

set textBox2::Text = New System.Text.ASCIIEncoding()::GetString(type Convert::FromBase64String(TextBox1::Text)) *> Decode base 64 to text

View solution in original post

0 Likes
6 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Convert String Base64

Jump to solution

Please do not post your data (the Base64-encoded string) in a question like this. It's completely unnecessary and simply makes your question difficult to read.

Are you writing a managed .NET COBOL application? ToBase64String is a method of the .NET Framework's System.Convert class - or at any rate there is a method by that name in that class.

If that's what you're trying to use, then you have the wrong method. ToBase64String converts arbitrary data to Base64. It does not convert Base64-encoded data to its original form.

For that you want System.Convert.FromBase64String. It has a single parameter, which is the string containing the Base64-encoded data, and it returns a byte array.

0 Likes
Highlighted
Super Contributor.
Super Contributor.

RE: Convert String Base64

Jump to solution

Hello I need to convert the string passed and this is in Base64 that's all.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Convert String Base64

Jump to solution
0 Likes
Highlighted
Super Contributor.
Super Contributor.

RE: Convert String Base64

Jump to solution

I need to do a routine to decode on my system I can not depend on a Web site.

VB.NET --->  TextBox2.Text = Convert.ToBase64String(New System.Text.ASCIIEncoding().GetBytes(TextBox1.Text)) ´Encode text to base 64

VisualCobol --->  set reg-sai to type Convert::ToBase64String(New System.Text.ASCIIEncoding()::GetBytes(w-campo4)). *> Encode text to base 64

VB.NET ---> TextBox2.Text = New System.Text ASCIIEncoding().GetString(Convert.FromBase64String(TextBox1.Text)) ´Decode base 64 to text

VisualCobol ---> ???

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Convert String Base64

Jump to solution

try this:

set textBox2::Text = New System.Text.ASCIIEncoding()::GetString(type Convert::FromBase64String(TextBox1::Text)) *> Decode base 64 to text

View solution in original post

0 Likes
Highlighted
Super Contributor.
Super Contributor.

RE: Convert String Base64

Jump to solution

Muito obrigado Altair

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.