Base64 encoding/decoding in .NET - ABL

Posted by Aliaksandr Tarasevich on 30-May-2012 09:29

When I try to copy MemoryStream data as one piece from .NET side to ABL using Base64 encoding function I get an error - Could not convert LONGCHAR to cpinternal. (11669). But when I try to copy the exact same MemoryStream splitting it into two pieces, it work fine:

This doesn't work:

cBase64 = System.Convert:ToBase64String(rMemoryStream:ToArray()).

This works just fine:

lcBase64 = System.Convert:ToBase64String(rMemoryStream:ToArray(), 0, 24573).                                               
lcBase64 = lcBase64 + System.Convert:ToBase64String(rMemoryStream:ToArray(), 24573, INTEGER(rMemoryStream:Length - 24573)).

What I'm missing?

OpenEdge 10.2B05

Thanks,
Aliaks

[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/simpleExample.p.zip:550:0]

[View:~/cfs-file.ashx/__key/communityserver-discussions-components-files/19/test_2D00_rus.zip:550:0]

All Replies

Posted by jquerijero on 30-May-2012 10:58

I'm experiencing the same problem. I ended up using a StringBuilder to hold the MemoryStream:ToArray() output then concatenate the StringBuilder property Chars to a LONGCHAR variable.

This thread is closed