Component name in GCM allows to create with special characters "~!@#$%^&*()_+:"<>?:" WIll there be a problem when we use Rest / Oslc API to fetch component using its name?
Hi,
GCM tool is allowed to create a component with special charcters "~!@#$%^&*()+:"<>?:
Is there any problem when we try to fetch components using special characters?
Above mentioned document link shows if Special characters like "%" and "" to be used with "LIKE" operator.
Kindly let us know if there a need to handle other special characters.
Thanks in advance
Regards,
Thiru
Accepted answer
Hi Thiru,
I tried 2 examples with mixed success. I created components with the following names:
Component "abc"
Component ~!@#$%^&*()_+:<>?:
An OSLC query for components in that project area without specifying
oslc.where
returned both components as expected.
I tried a query with [unencoded] query
dcterms:title="Component \"abc\""
. So the GET was from
https://localhost:9443/gc/oslc-query/components/_BK0hIIpOEey3Ft6q3I-bSg?oslc.where=dcterms%3Atitle%3D%22Component%20%5C%22abc%5C%22%22
. That didn't find the component. That should have worked but didn't. I will submit a defect against that and investigate when I get the chance.
I tried a query using % to match the embedded double quotes using an [unencoded] query
dcterms:title="Component %abc%"
. So the GET was from
https://localhost:9443/gc/oslc-query/components/_BK0hIIpOEey3Ft6q3I-bSg?oslc.where=dcterms%3Atitle%3D%22Component%20%25abc%25%22
. That worked and found the first component.
I tried a query for [unencoded] query
dcterms:title="Component ~!@#$%^&*()_+:<>?:"
. So the GET was from
https://localhost:9443/gc/oslc-query/components/_BK0hIIpOEey3Ft6q3I-bSg?oslc.where=dcterms%3Atitle%3D%22Component%20~%21%40%23%24%25%5E%26%2A%28%29_%2B%3A%3C%3E%3F%3A%22
. That returned the 2nd component ok.
In GCM 7.0.2iFix08 onwards, there are some characters that are automatically removed and or replaced from the names of components, configurations, type resources, user queries. These centre around Unicode control characters and Unicode whitespace characters. For example, embedding a zero-width non-printing space character is just likely to cause confusion, as is embedding multiple space characters between words in names. So if you try to create a component with name
abc def
it will get collapsed to
abc def
.
I would avoid using unnecessarily exotic characters in the names of GCM resources. Just because you can doesn't mean it's a good idea to do so. Think of visually impaired users who might struggle to see some punctuation characters.