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:

  1. the xml file places single space .net places plus
  2. similarly, xml file has pair of consecutive spaces inserted vs. .net's plusses

    pgplbmrv ymoknsaw vs. pgplbmrv++ymoknsaw

  3. 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

  4. 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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -