Project

Profile

Help

Diacritics in location.hash

Added by Jan Pour over 7 years ago

I would like to use diacritics in hash bang like this: #!epg/btnFtx:start=1__qtext=moře

And I use this template to process onhashchange event:



	

And when I set url with that hash bang in the browser, it returns an error: Fragment contains invalid character: ř client.net.sf.saxon.ce.tree.util.URI$URISyntaxException: Fragment contains invalid character: ř

How to solve this? Should I use the encode-for-uri() function to set the hash and then decode it back? But how? (I read in forums that there is no such decoding function..)


Replies (1)

RE: Diacritics in location.hash - Added by O'Neil Delpratt over 7 years ago

Hi,

As a work-around you can call back to JavaScript in Saxon-CE using @decodeURI@. See the code snippet below, which works fine:



...

Notice I have used @iri-to-uri@, if you prefer using @encode-for-uri@, you will have to concatenate the parts of the URI around 'ř'.

    (1-1/1)

    Please register to reply