c# - Java Base64 encoded string vs. .NET Base64 encoded string -
problem: have .net http handler taking http post of xml originating, believe, java system. 1 element contains base64 string encoded document (current test file pdf). when take original pdf , generate base64 string .net, there discrepancies between , corresponding text in supplied xml.
there number of places 1 of 3 things occurs:
- the xml file places single space .net places plus
similarly, xml file has pair of consecutive spaces inserted vs. .net's plusses
pgplbmrv ymoknsaw
vs.pgplbmrv++ymoknsaw
sometimes xml file has pair of consecutive spaces inserted vs. .net's plusses and additional spaces added nearby in xml's version
3kups 85qzwyaw bsmnals
vs.3kups 85qzwyaw++bsmnals
source xml have 4 spaces (display below looks 2 spaces) vs. .net's has pair of consecutive plusses
vgdmkej gnjeok
vs.vgdmkej++gnjeok
also, there no plusses in source (java created?) data.
questions: can identify cause these discrepancies might be? pressingly how might address them can't see reliable pattern against search , replace?
edit: when post arrives, url decoding before deserializing object.
public void processrequest(httpcontext context) { try { streamreader reader = new streamreader(context.request.inputstream); context.response.contenttype = "text/plain"; var decodedrequest = httputility.urldecode(reader.readtoend()); ...
the plusses being converted spaces through urldecoding, in spaces represented plusses. there shouldn't spaces in actual base64 encoded result; space invalid character. perhaps simple search , replace correct that, may want identify how result being urldecoded.
Comments
Post a Comment