HTML through POST method not being displayed properly

5
Hi community,   My name is Douwe Meuldijk, doing Mendix just over 4 months and this will be my first post on the Mendix forum. Glad to receive any advice!  I have been working the past few weeks on a REST link between a CSM and an external website. Certain data in the CMS is being forwarded to this website, based on the users’ request. The link has been technically and functionally tested and does its job – in the sense of, data can be published from the CMS on the website.   However, I discovered that data in some fields was cut off at a "random" point, when being displayed on this external website. This "random" point turned out to have to do with diacritics.   Sending plain text, which includes diacritics, works great. But it doesn't work well with HTML text. It is being displayed well on the external website, but as long as the HTML text contains no diacritics.   Through ‘trace’ I can see that Mendix properly formats the HTML text accordingly. Also, I can see through the Debugger that the forwarded text is nowhere being cut off and has a correct format.   Interestingly, when I paste exactly the same HTML text into a Postman call, it is perfectly displayed on the external website. Even though I copied this HTML text directly out of the Mendix debugger. The external website therefore does not seem to be the issue. Yet, Mendix shows that it forwards exactly the same text as Postman.   I have asked the administrator of the external site whether he can see what kind of data is being received when a post method is being executed. I therefore did two requests, one via Mendix and one through Postman. He states the following: ”There is a difference in raw data between the two requests.   If the header x-www-form-urlencoded is set, then the server expects for example "Pa$$w0rd" as POST variable: "Pa%24%24w0rd" There are now 2 options: Encode the html data or give another content type header (or perhaps try without content type).   Perhaps I have looked to long at the issue or I'm misunderstanding the administrator (or both :) ). But two questions have arisen: What is exactly the essence of the problem here above? Are the proposed solutions by the administrator (possibly) valid?   Hereunder three relevant screenshots of the REST call: a) The used content type in the header   b) The, in accordance with form-urlencoded, data, saved in a string variable   c) The request template in the POST method    
asked
1 answers
12

You could use the urlEncode() function to encode your string

answered