Problem: I have a .NET HTTP Handler taking an HTTP POST of XML which is originating, I believe, from a Java system. One element contains a base64 string encoded document (current test file is a PDF). When I take the original PDF and generate a base64 string from .NET, there are some discrepancies between that and the corresponding text in the supplied XML.
There are a number of places where one of three things occurs:
- The XML file places a single space where .NET places a plus
Similarly, the XML file has pair of consecutive spaces inserted vs. .NET's plusses
PgplbmRv YmoKNSAwvs.PgplbmRv++YmoKNSAwSometimes the XML file has pair of consecutive spaces inserted vs. .NET's plusses and additional spaces are added nearby in the XML's version
3kuPs 85QZWYaw BsMNalsvs.3kuPs 85QZWYaw++BsMNalsSource XML will have four spaces (display below looks like 2 spaces) vs. .NET's has a pair of consecutive plusses
vGDmKEJ gnJeOKvs.vGDmKEJ++gnJeOK
Also, there are no plusses in the source (Java created?) data.
Questions: Can someone help identify what would cause these discrepancies might be? Most pressingly how I might address them as I can't see a reliable pattern against which to search and replace?
Edit: When the POST arrives, it does do URL decoding before deserializing to an 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());
...