Comments (6)
can you provide an example without any library that still fails? in this example it could as well be expected browser or backbone behavior
from browser-run.
I verified this issue using only node url parser and it seems that this is expected behavior. I guess I'll have to dig deeper into this now.
Still not sure why there's a parse error though.
from browser-run.
Well, that're surprising results.
Test case:
var tape = require('tape');
var url = require('url');
tape('unicode routes', function (t) {
var exampleUrl = 'http://example.com/тест#тест';
var link = document.createElement('a');
link.href = exampleUrl;
console.log('Simple string: тест\n');
console.log('Browser parsed pathname: ' + link.pathname.substr(1));
console.log('Node parsed pathname: ' + url.parse(exampleUrl).pathname.substr(1) + '\n');
console.log('Browser parsed hash: ' + link.hash.substr(1));
console.log('Node parsed hash: ' + url.parse(exampleUrl).hash.substr(1));
});
Results:
Simple string: те�т
Browser parsed pathname: те�т
Node parsed pathname: те�т
Browser parsed hash: %D1%82%D0%B5%D1%81%D1%82
Node parsed hash: те�т
At least we're down to hash parsing only ;)
Or not.
Here're results straight from the browser console (works same if we simply embed link into the DOM):
Test case:
var foo = document.createElement('a');
foo.href = 'http://example.com/тест#тест';
console.log('Pathname: ' + foo.pathname);
console.log('Hash: ' + foo.hash);
Results:
Pathname: /%D1%82%D0%B5%D1%81%D1%82
Hash: #тест
Completely other way around :s
from browser-run.
this is the same if you just run that code in your browser's dev console:
var str = 'тест';
str.substr(1); // "ест"
var link = document.createElement('a');
link.href = 'http://example.com/тест#тест';
link.pathname; // "/%D1%82%D0%B5%D1%81%D1%82"
link.hash; // "#тест"
from browser-run.
This made the example work, I think this issue can be closed
test("routes with unicode", function (t) {
location.replace('http://example.com#search/' + encodeURIComponent('тест'));
Backbone.history.checkUrl();
t.equal(router.query, "тест");
});
The syntax error was due to ä needing to be in quotes if used as an object index.
from browser-run.
Great catch @wraithgar! Thanks :)
from browser-run.
Related Issues (20)
- `browser-launcher` is no longer maintained HOT 32
- Issues to many xhr HOT 15
- Hangs in FF. running window.close() won't finish process HOT 11
- Cannot run unpublished version HOT 3
- [OS X] Window focus doesn't go back to the terminal after switching to Electron
- Doesn't work with Chrome on MacOS HOT 1
- An in-range update of electron-stream is breaking the build 🚨 HOT 2
- Works in everything EXCEPT Electron HOT 11
- An in-range update of source-map-support is breaking the build 🚨 HOT 1
- going form 3.5.0 to 3.6.0 breaks http CORS requests and --mock HOT 3
- doesn't work with js code that contains a </script> HOT 3
- Node postinstall script fails HOT 1
- Publish 4.1.1 to npm registry HOT 2
- node_modules\browser-run\index.js:4:22 Cannot resolve dependency HOT 3
- Firefox: Unhandled stream error in pipe. HOT 6
- Usage on GitHub Actions with xvfb HOT 11
- Browsers other than electron don't close HOT 2
- No output HOT 8
- Support import in scripts HOT 2
- output stream error HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from browser-run.