HTML encoding issues

Recently I discovered some HTML encoding issues in Mendix 7 which are still present in Mendix 9, so it seems they have been there for a while.  First of all, when searching a text for html encoded characters you're not gonna find them. What I mean is that when you enter &lt; in the search box, it is NOT returning texts containing this character sequence. Instead the &lt; entered is treated as it's decoded equivalent ‘<’. Thus returning only text containing ‘<’. Example: The following strings in the database: this string contains &lt; and <  this string contains &lt; this string contains <   Searching for &lt;, would yield 1 and 3. Whereas searching for ‘<’ would yield the same result, The only way to find the &lt; text is by searching for a part of the encoding, like ‘&lt’.   The second HTML encoding related issue, has to do with OData. It turns out that < and & in OData are replaced by their HTML encoded counterparts. However the greater than (>) sign is NOT! If that is not a bug, at least it is an inconsistency and result unwanted behaviour. You either encode the entire string or you don't encode it at all!   I've reported both issues to Mendix, but they state that everything works as intended. I tend to disagree, so I'm just curious what the ‘experts’ and users of the platform think about these encoding issues.  OData html encoding issue Search encoding issue
2 answers

The way I work with this, is that I dupicate the attribute as a NOHTML attribute. In the After commit event I fill it with html decoded value of the original attribute, and use this field in datagrids and places for searching text.


May be this will help you….


Hi Sander

with respect to the search I would also consider this a bug – I don’t see any good reason it should work like this.

The second case is not a bug: the > character doesn’t need to be escaped in xml text.

regards, Fabian