0

The URLs for a Drupal 7 site are like the following ones:

I am into module development and this is quite irritating. How do I display the special characters, the "slashes/", "#", "&" symbols that have been converted to hexadecimal codes?

1

You can use the following snippet.

$decoded_url = rawurldecode(rawurldecode($url));

For example, for the second URL, the code returns http://example.com/drupal7/?q=node/1#overlay=?q=admin/config/content/formats.

That URL anyway is not usable as it is, as it would be wrongly parsed. For example, if on my browser I enter http://tero.local/dr72/?q=node/1#overlay=?q=admin/config/content/formats (tero.local is the local name used from my computer), what I get is the following page.

screenshot

As you see, the overlay is not shown.
Differently, when I enter http://tero.local/dr72/?q=node/1#overlay=%3Fq%3Dadmin%252Fconfig%252Fcontent%252Fformats, I get the following.

screenshot

In this case, the overlay is rendered.

  • but are there any settings to change so that it shows the decoded url by default in the url bar ?? i mean why is it displaying like this in the 1st place ? – geeky_bat Jun 3 '12 at 14:51
  • 2
    @Arjun It's displaying like that because the URL would be invalid otherwise. Special characters in a query string must be encoded – Clive Jun 3 '12 at 16:56
0

@kiamlaluno- thanks man ! seems like drupal 7 displays the url's with the corresponding hex codes for special symbols when the overlay feature is 'ON'.

For those who dont want to work with these url's the solution is to disable the overlay core module from- Configuration >> Core modules >> Overlay >> Save Configuration

This disables the Overlay and 'Normal' Urls with no hex code appear in the address bar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.