Problem with curly braces
OpenUI5 version: 1.44.15 and 1.46.9
Browser/version: Chrome 59, IE11
URL (minimal example if possible): https://gist.github.com/grischan/5f985539809714b0a87883dd46a56281
Steps to reproduce the problem:
- Open the gist.
- Download and open the index.html in Chrome
What is the expected result? There is a "{" in the text of an property. Thats an syntaxError for UI5 because, it indicates an binding. It would be great if only this property is affected and the ui gets rendered.
What happens instead? The whole UI get broken.
Any other information? (attach screenshot if possible)

Hello Christian!
At first glance, it Looks like the string "Geo{rge Washington" is only contained as data inside a JSON model. Is that true? In this Case, I would not expect a Syntax error at all. Data should be allowed to contain all Kinds of characters, I would say.
Best regards, Thomas
In this example, it is in the json, for reproducing the error. (In our real world a user enters surcha wrong string in the system and the ui5 app consume this data through an odata-service). The curly-baces are used to define complex bindings. So the error is correct, but the problem is, that the whole view stops to render, not only this property.
"the error is correct" - sorry, but I disagree. Curly braces in data must not be interpreted as binding path Syntax. If that would be OK, what would be the way to really Display "Geo{rge Washington" on Screen? A formatter that does escaping? I don't think so!
By the way: I just tried with one of our V4 OData sample apps and it works fine. You can enter "Geo{rge Washington" and save it and Display it later on...
P.S.: "Download and open the index.html in Chrome" does not work for me. file:// and https:// URLs are mixed then... And data-sap-ui-resourceroots='{"sap.m.sample.FeedListItem": "./" Looks wrong to me...
Add --disable-web-security --allow-file-access-from-files to start chrome. Then you can open the index.html file in chrome.
This issue appears not in all properties of controls. For example, "text" property of sap.m.FeedListItem is escaped correct and '{' is displayed. If you try to bind a text with '{' to the 'sender' property, the Exception is thrown.
Can be reproduces with OData V2 model.
"This issue appears not in all properties of controls." Then I would say it is a bug of those properties/controls where it appears.
Hi,
I've created an internal incident 1780301433. The status of the issue will be updated here in GitHub.
Best, Teo
The general contract of UI5 regarding curly braces ("{") in property values is:
- when the string is given to the constructor or to the applySettings function of a
ManagedObject, then it will be checked for bindings (indicated by curly braces, depending on the chosen binding syntax) - when a string is given to the setter method of a property (
setXYZmethod), the string won't be interpreted as a binding. As data binding internally calls thosesetXYZmethods, no model value ever should be checked for bindings.
But this simple differentiation becomes more complex in real life: when a composite control gets a value via one of its setXYZ methods but then creates a new control from that value (e.g. an icon or image), then it either has to escape the string value before propagating it to the constructor or it has to set the string value after construction of the control by calling the corresponding setXYZ method.
The stack trace in the screenshot suggests that the error occurs inside the IconPool's createControlByURI method. That helper method can't know about the nature of the data, so the caller has to decide.
I guess that in the scenario above, none of the two approaches has been chosen and therefore the error occurs. I'll update the internal incident with this information.
Hi, Thank you for your ticket! The issue in sap.m.FeedListItem has been fixed and the fix is provided in the current development version and in the next versions of 1.48, 1.46, 1.44, 1.38 and 1.28. Best regards Sylvia
Exactly the same happens for the description for the same control....
It would make sense that this should be escaped in all properties
The general contract of UI5 regarding curly braces ("{") in property values is:
- when the string is given to the constructor or to the applySettings function of a
ManagedObject, then it will be checked for bindings (indicated by curly braces, depending on the chosen binding syntax)- when a string is given to the setter method of a property (
setXYZmethod), the string won't be interpreted as a binding. As data binding internally calls thosesetXYZmethods, no model value ever should be checked for bindings.But this simple differentiation becomes more complex in real life: when a composite control gets a value via one of its
setXYZmethods but then creates a new control from that value (e.g. an icon or image), then it either has to escape the string value before propagating it to the constructor or it has to set the string value after construction of the control by calling the correspondingsetXYZmethod.The stack trace in the screenshot suggests that the error occurs inside the
IconPool'screateControlByURImethod. That helper method can't know about the nature of the data, so the caller has to decide.I guess that in the scenario above, none of the two approaches has been chosen and therefore the error occurs. I'll update the internal incident with this information.
Thank you, this was very helpful.
In my case, I wanted to display ${variable} in a text, and I couldn't.
Instead of new HelpIcon({text: '${variable}'}), I did new HelpIcon().setText('${variable}') and it worked fine.
@hugo-dlb and future readers: after the https://github.com/SAP/openui5/issues/1595#issuecomment-316020849 by @codeworrior, the API ManagedObject.escapeSettingsValue has been introduced which can be used if the managed property value needs to be escaped in the constructor settings.