2.16 Internationalized URLs
SData URLs may contain non ASCII characters. A typical example is a query like:
http://www.example.com/sdata/myApp/myContract/prod/accounts?where=name eq ‘le roi du béton’
This URL is invalid because the é letter is not an ASCII character. SData uses the following encoding to pass non ASCII characters in URLs:
- The character is converted to its UTF-8 representation. For the é letter, this is a 2 byte hexadecimal sequence: C3 A9
- Each byte of the UTF-8 representation is “percent encoded”. So the é letter becomes %C3%A9
The correct representation for the example URL is then:
http://www.example.com/sdata/myApp/myContract/prod/accounts?where=name eq ‘le roi du b%C3%A9ton’
The "like" operator uses the percent sign as wildcard character. As the percent sign is used to escape special characters it must be escaped and passed as %25 (% is an ASCII character, so its UTF-8 representation is just its ASCII value, 25 in hexadecimal notation).
SData providers and consumers MUST use the encoding described above to pass non ASCII characters in URLs URLs that are embedded in XML payloads returned by the provider (for example href values for links) MUST be percent encoded by the provider so that the consumer can use them directly. Similarly, URLs that are embedded in XML payloads posted by a consumer MUST be percent encoded on the consumer side prior to posting.