-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backbone navigate - url encode in different language with diacritics #4085
Comments
On Ubuntu Chrome, whenever I click on either English string or the one with diacritics, I still get single alerts for both. Maybe the problem is not with backbone at all but your local stack? |
Hello, I have some reports that we are also seeing this issue. I did some investigation into this. I could not replicate it using the jsfiddle in chrome/windows. On Safari on the Mac, I did see the issue. At the root, the problem seems to be that in webkit (replicates issue), the location hash is URL encoded, but in chrome (does not replicate), the URL hash is not encoded. I will attach screenshots showing the behaviour and how it causes the route to fire twice. Firstly, the route function fires once due to the jsfiddle code calling route.navigate, which calls loadURL. This is expected behaviour and happens on all platforms so I won't mention it again: Following the handling of this event, a hash change event fires. This causes the checkUrl method to fire: Note that the value of location.href and the return value from this.getFragment() are encoded. BUT the value of this.fragment is not encoded. The check at line 1774 fails, which causes line 1775 to do this.navigate() again. This causes the route function to fire a second time. |
Actually this is more confusing than I originally thought. The "encoded" version of the href in safari isn't the URL encoded version of the original URL. The value "%03" decodes to some not printable value. |
the hash It seems there is a change in chrome 63 (also similarly introduced a while ago in some earlier version of iOS Safari) where the hash portion of the location.href is encoded, where it used to be decoded Fixes jashkenas#4085
Possibly fixed in 4026, but need to check. |
I have a search form that redirects the user to
search/thetermusersearched
wherethetermusersearched
is the exact value he entered. All this with the navigate function provided by Backbone.This is all fine when I use strings in English (masa de calcat), but when I add diacritics in the input (masă de călcat) I get the route function fired twice.
The problem I have is in Firefox and Safari (the later in Mac and iOS)
I tried using
encodeURI
andencodeURIComponent
when I use thenavigate
, but no success.HTML
JS
See fiddle here: http://jsfiddle.net/adyz/qcged76e/4/
Any thoughts on this?
The text was updated successfully, but these errors were encountered: