Disable auto-decoding of URL in Location bar.

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Post Reply
_development
Posts: 332
Joined: October 19th, 2007, 9:29 am
Location: Montevideo, Uruguay

Disable auto-decoding of URL in Location bar.

Post by _development »

Hello!
I found the "feature" auto-decoding of URLs very annoying. If I edit the URL the link gets broken :(

Anyone know how to disable this?

Example..

Code: Select all

This real url:
http://www.dmoz.org/World/Espa%C3%B1ol/?some=Espa%C3%B1ol/
Shows as:
http://www.dmoz.org/World/Español/?some=Español/
If I add:
http://www.dmoz.org/World/Español/?some=Español/Artes
I get:
http://www.dmoz.org/World/Espa%C3%B1ol/?some=Espa%F1ol/Artes

](*,) ](*,) ](*,)
thanks!
Last edited by _development on December 19th, 2010, 8:40 am, edited 1 time in total.
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: Disable auto-decoding of URL in Location bar.

Post by trolly »

You can try network.IDN_show_punycode in about:config.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
_development
Posts: 332
Joined: October 19th, 2007, 9:29 am
Location: Montevideo, Uruguay

Re: Disable auto-decoding of URL in Location bar.

Post by _development »

Thanks, sadly is not working :/
_development
Posts: 332
Joined: October 19th, 2007, 9:29 am
Location: Montevideo, Uruguay

Re: Disable auto-decoding of URL in Location bar.

Post by _development »

The same happens with this browser. #-o
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: Disable auto-decoding of URL in Location bar.

Post by trolly »

I'll move it to "Web Development" for the guys to check the rules. Can be a bug.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
User avatar
jscher2000
Posts: 11742
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

Re: Disable auto-decoding of URL in Location bar.

Post by jscher2000 »

Is this a problem with a particular HTML editor, or forum/blog/wiki engine?

Edit: never mind, I see you mean in the Firefox location bar. The inconsistent encoding/decoding is very odd.
User avatar
dickvl
Posts: 54145
Joined: July 18th, 2005, 3:25 am

Re: Disable auto-decoding of URL in Location bar.

Post by dickvl »

Puny code doesn't apply to the path part of an URL.

It is the difference between escape() and encodeURIComponent().

https://developer.mozilla.org/En/Core_J ... IComponent
_development
Posts: 332
Joined: October 19th, 2007, 9:29 am
Location: Montevideo, Uruguay

Re: Disable auto-decoding of URL in Location bar.

Post by _development »

I investigated and fixed this problem. It even works with Locationbar2. ( now you can click encoded breadcrumbs that will load )

(may is not yet public [amo thing] try again in a few hours) https://addons.mozilla.org/en-US/firefox/addon/265088/

The real problem is that the URL is "decoded" without calling to "encode" first. It's like a "decode twice".. never ever decode an URL twice!!.. never. really.
And always encode your parameters with encodeURIComponent.

Let's put the problematic example.

You have :

Code: Select all

http://www.example.net/Espa%C3%B1ol/?anurl=http%3A%2F%2Fwww.example.net%2FEspa%C3%B1ol%2F%3Fnada%3Dtrue%26acolor%3Dgotcha%26var2%3Dsome2&acolor=white

Here what we do is to send two parameters to example.net domain.
anurl : which is a very valid url.
acolor : which contains the value "white"

OK. Now let's decode this URL.

Code: Select all

http://www.example.net/Español/?anurl=http://www.example.net/Español/?nada=true&acolor=gotcha&var2=some2&acolor=white


Ok Now tell me the value of "acolor".. you can't right?

OK now let's encode again this URL.

Code: Select all

http://www.example.net/Espa%C3%B1ol/?anurl=http://www.example.net/Espa%C3%B1ol/?nada=true&acolor=gotcha&var2=some2&acolor=white


Oh wait. What happened to my anurl parameter...?

If you decode your URLs twice you will never be able to get the original URL. (unless you save the original URL somewhere)
_development
Posts: 332
Joined: October 19th, 2007, 9:29 am
Location: Montevideo, Uruguay

Re: Disable auto-decoding of URL in Location bar.

Post by _development »

Fixed this too in the Locationbar2 extension.

- It shows everything decoded, (more than original version).
- When selecting, it show real URL ( allows editing )
- Breadcrumbs works everywhere.
- Tooltip shows decoded.

https://github.com/titoBouzout/locationbar2-utf8

Regards.
_development
Posts: 332
Joined: October 19th, 2007, 9:29 am
Location: Montevideo, Uruguay

Re: Disable auto-decoding of URL in Location bar.

Post by _development »

Here there is a workaround without extensions from a friend:

Copy and paste the URL

1. CTRL+L (to select the URL)
2. CTRL+C (to copy)
3. CTRL+V (to paste)

In your example:

Code: Select all

the browser shows this:
http://www.dmoz.org/World/Español/?some=World/Español/
you press CTRL+L,C,V the browser shows:
http://www.dmoz.org/World/Espa%C3%B1ol/?some=World/Espa%C3%B1ol/
now you can add "Artes" manually to the end of the URL and you will get
http://www.dmoz.org/World/Espa%C3%B1ol/?some=World/Espa%C3%B1ol/Artes
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: Disable auto-decoding of URL in Location bar.

Post by trolly »

I'm not sure if this classifies it as a bug. Opinions?
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
User avatar
Frenzie
Posts: 2135
Joined: May 5th, 2004, 10:40 am
Location: Belgium
Contact:

Re: Disable auto-decoding of URL in Location bar.

Post by Frenzie »

Loading the page seems to work regardless of your actions, but it sure is weird that it changes things around seemingly at random.
Intelligent alien life does exist, otherwise they would have contacted us.
Post Reply