Diacritics in location.hash

Added by Jan Pour about 11 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: ř$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 about 11 years ago


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 'ř'.


    Please register to reply