Skip to Content

Encoding Issue in SAP UI5 for NEO Application in SAP Cloud Platform

Dear Experts,

I am saving following data into HDI Containers as description for a field( this field is also a key field in HDI Container)

"Controllare l'assenza"

When I just open the metadata and open that particular entity in order to see whether data is really saved or not , Yes It is saved correctly

If we look at the Question Field which is also a key field of this entity , there is a Italian special character. and this entity should be read by using this URL according to the entity

Here I can see two special characters for one special character in real(see the first screen shot , real data in DB is having one special symbol)

and I am not sure how to get this special character dynamically because there can be more special characters. If i have to update this particular entry of this entity , I need to pass this exactly like that , other wise, I can't update this.

can somone please help me deal with this?

download-3.png (77.2 kB)
download-2.png (20.1 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Aug 05, 2020 at 09:40 PM

    Hi, this is actually expected to happen in OData URIs, because values are enclosed by single quotes, and duplicating it is the way the protocol handles to escape it inside a string value (string literal). I linked from v4 version (because I didn't located the full specification for v2), but pretty much applies to all versions, as it says on URL syntax section:

    For example, one of these rules is that single quotes within string literals are represented as two consecutive single quote.

    You have to escape single quotes pretty much like the OData spec says to address that entity. I think (didn't tested) the UI5 library should manage that on createKey model's method automatically when you provide exactly as you have saved in your entity (we also have this as a inner reference, telling on search string but also applies to key values).

    If that is too much work consider changing that key field to a numeric one. Language-dependent text as a key is not a wise thing to do, specially if multilingual usage is expected. ABAP world already have many hazardous code lying on same language-text root, please don't take that bad practice to HDI.

    Best regards

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Thales Batista ,

      Thanks for your inputs. Actually model will create the key correctly . But if you have to update an existing entry , you need to also pass Entityset(KeyField1 = 'Value''withQuotes'

      Value' withQuotes is the actual value and we need to pass 2 quotes in order to update/read the entry correctly. Anyway , I tried to replace single quotes with 2 quotes before passing

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.