2
votes

I've created a SAPUI5 table widget and made sure that it works. Now, when clicking on a row, the detail view is loaded, but no data is present. The server exposes an entity Site with a primary key which is of type "string".

The client-side code is as follows (assume that oModel is ODataModel, sSiteCode is a string that may contain Cyrillic characters):

        // sSiteCode may contain Cyrillic characters
        var oKey = {
            SiteCode: sSiteCode
        };
        var sPath = "/" + oModel.createKey("Sites", oKey);
        this.getView().bindElement({path: sPath});

It turns out that, if sSiteCode = 'б' (i.e., contains Cyrillic characters), then a GET request will be sent (via batching) to the following URI:

http://<server>:<port>/odata/Sites('б')

However, the server is unable to parse this URI (and subsequently replies with a 404), as it doesn't know what encoding to use. I patched the method ODataModel.prototype._createRequestUrl as follows:

    sNormalizedPath = this._normalizePath(sPath, oContext);
    sNormalizedPath = encodeURI(sNormalizedPath); // my addition

Then it seems to work, for this particular case. I'm wondering if this is a bug or a feature, and what should I do next?

FYI, I'm using OpenUI5 1.32.11.

1
If you really think it's a bug worth fixing, post it in their github repository: github.com/SAP/openui5/issues - Marc
Thanks for the suggestion Marc. I've filed a ticket: github.com/SAP/openui5/issues/830 - Artyom Shalkhakov

1 Answers

0
votes

Instead of sending

http://<server>:<port>/odata/Sites('б')

The actual string sending to the server should be

http://<server>:<port>/odata/Sites(%27б%27)

Which is the result of the encodeURI() call. Since UI5 allows you to freely define the Models URL and its parameters you have to take care on the correct URI encoding (and all parameters).

So in my opinion this is not a bug but the down part of the possibility to configure the URI without "black-box" behaviour of UI5.