Implicit encoding on REST Input?

Dear forum, When consuming XML from a REST interface, I get strange behavior when trying to compare the received text to a String field on one of my objects. The basic idea is to build an interface (regression) testing program so I want to compare the interface output against an expected response. What works is the following: I send an interface request to a REST endpoint. I get a result back (XML inside JSON envelope). I can parse the JSON to extract just the XML. Then I can save that XML as an expected response. The next time I run the interface I can compare against the expected response that I saved before. If the results match: the interface passes testing If they do not match: the interface needs some attention This is not exactly what I want however: I want the expected response to change with each test. For example, I want to use a variable in my request and then check if that variable is what is coming back. This is where it is getting strange: as soon as I change my expected response (through the web interface), it automatically is changed in a way that makes it incomparable to new results coming in from the interface. What I first tried is to add a variable and then resolve it, but even though the resulting text is 100% similar (copying into Notepad++ does not reveal any differences, I know that is no foolproof method but it's a start), an equals comparison always fails. Even if I (for testing purposes) just insert a space and then remove it again, the match will not succeed anymore. My initial thought was that some kind of implicit conversion was taking place when editing the expected response so I thought: if I cannot somehow change back the expected response to be exactly similar to new incoming data, maybe I can just manipulate incoming data to replicate whatever happens when I manually change the expected response. No luck however: if I change the incoming data and then remove the changes (insert a string, remove it again, just like what I do in the GUI with the expected response), I can still not compare the values. Does anybody know if some kind of implicit conversion is taking place when editing data in the GUI? I am using 8.14.
1 answers

Well, I finally figured it out. Thought I would share this with everybody else although (as so often the case when you know what the problem was) it is kind of embarrassing: The strings I received had both CR and LF characters (see this article for some explanation, although there is so much more to find on this). Mendix only keeps LF characters so once I stripped all the CR characters away, my problem disappeared:

replaceAll($ResponseMessage/Contents, '\r', '')

How I found this was by creating a Java action to display the character codes and then it became pretty (painfully) clear pretty quickly.