Problems with HTML escaping and non-ASCII characters using the JSON OSLC API
I'm using the OSLC API for RTC. Here's what I did:
1. Create a defect with the summary ">". Then retrieve it. The result says that "dcterms:title" is ">". Is this a bug? Shouldn't this be ">"? 2. Use the OSLC query API to search for this issue by 'oslc.where=dcterms:title=">"'. This returns no results. Changing it to 'oslc.where=dcterms:title=">"'. Is there a reason behind this inconsistency? 3. Doing the same with " " (non-breaking space,  , \u00A0) does still not give any results using the query API even though I HTML-unescaped and Unicode-escaped the character. How can I work around that? Am I doing something wrong? This is not an artificial problem. There are lots of defects with non-ASCII characters. Has anyone else encountered (and solved) this issue? |
One answer
escaping data for JSON is a pain.
I use this online tool to figure out my json problems http://codebeautify.org/jsonvalidator I typically have to convert the xml type chars to their escaped values, >, <, ", etc... online doc for unicode escapes is Unicode escape sequences
Any character with a character code lower than
Unicode escapes are six characters long. They require exactly four characters following
The copyright symbol (
The hexadecimal part of this kind of character escape is case-insensitive; in other words,
You could define Unicode escape syntax using the following regular expression:
Comments
Fabian Zaiser
commented Aug 09 '16, 10:57 a.m.
Thanks for your answer! Unfortunately, it doesn't solve my problem. My problem is not how to escape Unicode characters but that the query API doesn't work despite escaping (my bullet point 3). (My other problem is being annoyed with the HTML escaping but I can work around that.)
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.