kakawait / hugo-tranquilpeak-theme

A gorgeous responsive theme for Hugo blog framework
https://tranquilpeak.kakawait.com
GNU General Public License v3.0
927 stars 526 forks source link

Url encoding problem: %C3%A9 > e%CC%81 #306

Closed kkuom closed 5 years ago

kkuom commented 6 years ago

Configuration

Problematic behavior

I'm french, so I sometimes need to write accented characters, like: title: "La posture éducative - Punition, Sanction, Autorité & Cadre" With github, I have no problem, as you see when you click on the link below: https://kkuom.github.io/SecondSouffle/2018/08/la-posture-%C3%A9ducative---punition-sanction-autorit%C3%A9--cadre/ Firefox display "é" in URL bar, but "é" is encrypted with "%C3%A9".

Then, when I use my personal server OVH (www.secondsouffle.me), by writing in "config.toml" baseURL = "https://www.secondsouffle.me/", all my links with accented characters doesn't work anymore. in my index page www.secondsouffle.me, if I want to click in "La posture éducative - Punition, Sanction, Autorité & Cadre", I have error 404. Indeed, the URL link sends me on https://www.secondsouffle.me/2018/08/la-posture-%C3%A9ducative---punition-sanction-autorit%C3%A9--cadre/ but OVH needs this encoding to display my post: https://www.secondsouffle.me//2018/08/la-posture-e%CC%81ducative---punition-sanction-autorite%CC%81--cadre/index.html

I already tried many things, like create a .htaccess file, or adding in head.html: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

It doesn't work. Do you know how can I fix it? Many thanks, and sorry for my english!

fu-sen commented 5 years ago

Unicode (including UTF-8) has a mechanism called Combining character: https://en.wikipedia.org/wiki/Combining_character

That is, as a representation method of é:

Currently UTF-8 is mainstream, so URL is reflected. This is not affected by the HTML character code.

Whether this is handled depends on the OS, text editor, FTP client, etc. (Windows does mainly not use combining character. MacOS or iOS mainly uses combining character)

Therefore, you may be able to solve this with an editor corresponding to UTF-8. Also, if you used FTP for uploading to the OVH server, there is a possibility that the FTP client converted it.

Alternatively, as a measure for avoiding this problem, tranquilpeak theme applies the title to the URL according to the following setting.

/exampleSite/config.toml :

[permalinks]
  post = "/:year/:month/:slug/"

There is a workaround to make it :filename instead of :slug : https://gohugo.io/content-management/urls/

By doing this, you can substitute file name for URL instead of title.

This is not only tranquilpeak theme level problem. Therefore it is inappropriate to report here issue.

kkuom commented 5 years ago

Sorry for the post if it was inappropriate. Anyway, thanks a lot for your answer, you solved the problem. :)

devlerenleren commented 1 year ago

file & path name were affected by this problem in my Python script, searching lyrics with LyricGenius, listening to sys.argv parameters from Fauxdacious (highly sophisticated media player) call, written in Perl ~ solved with long replace function ~

def process(fulpat) :
    fulpat = fulpat.replace('file://', '')
    fulpat = fulpat.replace('%20', ' ')
    fulpat = fulpat.replace('%21', '!')
    fulpat = fulpat.replace('%27', "'")
    fulpat = fulpat.replace('%26', "&")
    fulpat = fulpat.replace('%28', "(")
    fulpat = fulpat.replace('%29', ")")
    fulpat = fulpat.replace('%2C', ",")
    fulpat = fulpat.replace('%5B', "[")
    fulpat = fulpat.replace('%5D', "]")
    fulpat = fulpat.replace('%2B', "+")
    fulpat = fulpat.replace('%60', "`")
    fulpat = fulpat.replace('%23', "#")
    fulpat = fulpat.replace('%40', "@")
    fulpat = fulpat.replace('%C3%A9', 'é')
    fulpat = fulpat.replace('%C3%A4', 'ä')
    fulpat = fulpat.replace('e%CC%81', 'é') #Oumou Sangaré #???
    fulpat = fulpat.replace('%C3%85', "Å")
    fulpat = fulpat.replace('%C3%A6', "æ")
    fulpat = fulpat.replace('%C3%B8', "ø")
    fulpat = fulpat.replace('%C3%AD', "í")
    fulpat = fulpat.replace('%C3%BC', "ü")
    fulpat = fulpat.replace('%C3%89', "É")
    fulpat = fulpat.replace('%C3%A8', "è")
    fulpat = fulpat.replace('%C3%A1', "á")
    fulpat = fulpat.replace('%C3%B4', "ô")
    fulpat = fulpat.replace('%C3%B6', "ö")
    fulpat = fulpat.replace('%E2%80%93', "–")
    fulpat = fulpat.replace('%E2%80%90', "‐")
    fulpat = fulpat.replace('%E2%80%99', "’")
    return fulpat
devlerenleren commented 1 year ago

collection of music @ http://213.184.118.228/buitenwesten/TUNES/ (including Oumou Sangaré #???)

devlerenleren commented 1 year ago

anybody with a complete list [replace('%20', ' ')] URL ? THX