Skip to content
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

bad routing where there are non-english characters in page url #495

Closed
mderazon opened this issue Oct 10, 2015 · 2 comments
Closed

bad routing where there are non-english characters in page url #495

mderazon opened this issue Oct 10, 2015 · 2 comments

Comments

@mderazon
Copy link

HI,
I have just updated Harp to the latest version (0.19.0) and I am noticing a problem with my hebrew pages.

In my _data.json I have

"משהו-משהו": {
    "title": "משהו משהו",
    "date": "26 Nov 2013",
    "tags": ["hebrew"],
    "published": true
  },

My public folder has a משהו-משהו with an index.md that contain the post and when I go to /משהו-משהו I get a 404 page. It probably has to do with a recent change to harp as my older version was working correctly.

Any idea ?

@mderazon mderazon changed the title bad routing where there are non-english characters bad routing where there are non-english characters in page url Oct 10, 2015
@mderazon
Copy link
Author

looks like the url path is not being normalized well (I think): https://github.com/sintaxi/harp/blob/master/lib/helpers.js#L17

req.url comes url-encoded as %D7%9E%D7%A9%D7%94%D7%95-%D7%9E%D7%A9%D7%94%D7%95 and then after the normalize step I see it as ×�ש×�×�-×�ש×�×� instead of משהו-משהו. Therefor file is not found

@mderazon
Copy link
Author

mderazon commented Apr 7, 2016

So initially I thought it might be related to this nodejs/node#2165

And was trying to follow the guideline on how to work with different filesystems: https://nodejs.org/en/docs/guides/working-with-different-filesystems/#avoid-a-lowest-common-denominator-approach

After trying different approaches, I tried replacing unescape function with decodeURIComponent
(see this SO post: http://stackoverflow.com/a/619428/599912) and everything worked perfectly.

@sintaxi Do you want me to send a PR ? Do you think of any problematic consequence for this ? I tested this on my blog and it worked okay.

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

No branches or pull requests

2 participants