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

% characters are stripped out of URLs #1292

Closed
donlzx opened this issue Jul 20, 2015 · 4 comments
Closed

% characters are stripped out of URLs #1292

donlzx opened this issue Jul 20, 2015 · 4 comments

Comments

@donlzx
Copy link

donlzx commented Jul 20, 2015

The section variable passed into the pagination module is already URL encoded,

https://github.com/spf13/hugo/blob/master/hugolib/pagination.go#L370

but the pagination URLs are encoded again using function URLizeAndPrep() in

https://github.com/spf13/hugo/blob/master/hugolib/pagination.go#L515

This yields incorrect URLs for pagination templates.

For example, a section name contains accent characters (añame) encoded as a%C3%B1ame, when processed by function URLizeAndPrep(), will become ac3b1ame, the % characters are stripped out.

And there may be other cases for non-English section names which are not handled correctly.

Removing the call to the URLizeAndPrep() function temporarily fix this issue for me, but the URL handling should be reviewed and should be consistent with URLs in Nodes and Pages.

@donlzx donlzx changed the title Incorrect handling of URLs in pagination module Incorrect handling of URLs with accents characters Jul 22, 2015
@donlzx
Copy link
Author

donlzx commented Jul 22, 2015

It turns out that this issue is not limited to the pagination module. The issues is with the UnicodeSanitize() function stripping % characters in URLs:

https://github.com/spf13/hugo/blob/master/helpers/path.go#L97

@bep bep changed the title Incorrect handling of URLs with accents characters % characters are stripped out of URLs Jul 22, 2015
@bep
Copy link
Member

bep commented Jul 22, 2015

This precedes my time with Hugo. @spf13 might now why % are stripped?

@spf13
Copy link
Contributor

spf13 commented Nov 28, 2015

I just filtered out any character that may be an issue as part of a filename in any os, even some that were ok in urls. It seems innocuous enough to include this back in.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants