Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

How to use Unicode in slugs #347

Closed
aubergene opened this issue Aug 7, 2018 · 3 comments
Closed

How to use Unicode in slugs #347

aubergene opened this issue Aug 7, 2018 · 3 comments

Comments

@aubergene
Copy link
Contributor

aubergene commented Aug 7, 2018

Using the sample app, if I create a blog post with the slug unïcode-test then it currently 404s for that page. If I change [slug].json.js to url decode the slug then it works okay.

	let { slug } = req.params;
	slug = decodeURIComponent(slug)

However the output for the files is inconsistent, the JSON is url encoded and the HTML isn't.

   1.35 kB   blog/un%C3%AFcode-test.json
   4.97 kB   blog/unïcode-test/index.html

Tested using Sapper 0.15.6, node v8.1.4

Rich-Harris added a commit that referenced this issue Sep 3, 2018
better unicode handling - fixes #347, i think
@Rich-Harris
Copy link
Member

Reopening — I completely misunderstood the issue here and fixed a different bug instead...

@Rich-Harris Rich-Harris reopened this Sep 3, 2018
This was referenced Sep 3, 2018
@Rich-Harris
Copy link
Member

Ok, this should all work now — files have their filenames decoded before they're written during sapper export and (breaking change in 0.20!) you no longer need to do decodeURIComponent(slug); it comes to you in decoded form as it would with e.g. Express and /blog/:slug.

@aubergene
Copy link
Contributor Author

Confirmed fix. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants