Retrieving title from document with a Tilde in its reference

Hello,

As written in the title, when using the getTitle() - method to retrieve the title of a document with a Tilde in its reference, nothing is apparently retrieved (regardless if the document has a Tilde in its display-name or not).

image

In the provided image, usually the title of the document should be displayed there on the left. Which does not happen. However, if I rename a document (which doesn’t have a Tilde in its reference) to have a Tilde in its name, the title is displayed.

Here’s the velocity code that I’m using:
image

What seems to be the issue here?

Hi, you should not do manual operations on references, this will lead to all sorts of problems. XWiki is providing an API for that. You should consider the reference format as a black box.

See https://extensions.xwiki.org/xwiki/bin/view/Extension/Model%20Module#HScriptServiceAPI

Hope it helps

1 Like

Hello, this is indeed helpful and is something to improve my code on, but the initial issue still persists.

When using getTitle() , and the document contains a Tilde in its reference, then the Title is not displayed no matter what (even after renaming the page to not contain a Tilde!) ; getTitle() also doesn’t seem to return anything.

In a page with no Tilde in its reference, after putting a Tilde in its title (renaming it to be so) , the Tilde itself is not displayed. However this could be fixed from my side with escaping, as seen in the last line of velocity code I provided above.