MozillaZine

Disable auto-decoding of URL in Location bar.

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

Post Posted December 19th, 2010, 5:59 am

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.

trolly
Moderator

User avatar
 
Posts: 39899
Joined: August 22nd, 2005, 7:25 am

Post Posted December 19th, 2010, 7:42 am

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

Post Posted December 19th, 2010, 8:41 am

Thanks, sadly is not working :/

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

Post Posted December 19th, 2010, 8:55 am

The same happens with this browser. #-o

trolly
Moderator

User avatar
 
Posts: 39899
Joined: August 22nd, 2005, 7:25 am

Post Posted December 19th, 2010, 9:44 am

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.

jscher2000

User avatar
 
Posts: 10368
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA

Post Posted December 19th, 2010, 3:59 pm

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.

dickvl

User avatar
 
Posts: 52444
Joined: July 18th, 2005, 3:25 am

Post Posted December 19th, 2010, 5:18 pm

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

Post Posted December 20th, 2010, 12:00 am

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

Post Posted December 20th, 2010, 4:02 am

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

Post Posted December 21st, 2010, 12:52 am

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

trolly
Moderator

User avatar
 
Posts: 39899
Joined: August 22nd, 2005, 7:25 am

Post Posted December 21st, 2010, 5:40 am

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.

Frenzie

User avatar
 
Posts: 2134
Joined: May 5th, 2004, 10:40 am
Location: Belgium

Post Posted December 21st, 2010, 7:01 am

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.


Return to Web Development / Standards Evangelism


Who is online

Users browsing this forum: No registered users and 2 guests