Content: Page files with special characters (Å,Ä,Ö) results in 404

Created on 28 Jul 2020  Â·  2Comments  Â·  Source: nuxt/content

Version

@nuxt/content: 1.5.0
nuxt: 2.14.0

Reproduction Link

https://codesandbox.io/s/nuxtcontent-demo-qlh6z?file=/content/index.md

Steps to reproduce

  1. Have a file named with Å, Ä or Ö in the content folder. These are Swedish letters, but this issue is present for all Scandinavian characters.
  2. Navigate to the page with a special character in it.
  3. 404 :(

What is Expected?

Nuxt Content should fetch and display the file 'frågor'.

What is actually happening?

It tries to fetch 'fr%25C3%25A5gor' which results in a 404.

Other

I noticed this issue on my production site were it can't prefetch pages with those characters, but it can display them. When I created the reproduction link, it wont even display the page with special characters, just a 404 error.

bug

Most helpful comment

Are you running on a Mac or Linux, or on Windows?

On Linux/macOS it might work, because they actually are unicode for file names. But URLs aren’t 1:1 UNIX file system. Windows not sure.

Your issue boils down to one of the oldest IETF http design decision about unicode in an URL (link to similar StackOverflow question)

I write in french, I’m not native English myself (and so are Nuxt.js’ authors), it is common practice to name files on filesystem without spaces or anything that becomes URL encoded. Spaces, caractères accentués, emojis. At least content supports a title YAML front matter, so your title can be written correctly.

Also, don’t forget to add lang=fr-CA (your own), because screen reader and CSS will behave differently (W3C lang tag, w.r.t. CSS and Intl). I can give more info about Internationalization, but I went overboard already =)

All 2 comments

Are you running on a Mac or Linux, or on Windows?

On Linux/macOS it might work, because they actually are unicode for file names. But URLs aren’t 1:1 UNIX file system. Windows not sure.

Your issue boils down to one of the oldest IETF http design decision about unicode in an URL (link to similar StackOverflow question)

I write in french, I’m not native English myself (and so are Nuxt.js’ authors), it is common practice to name files on filesystem without spaces or anything that becomes URL encoded. Spaces, caractères accentués, emojis. At least content supports a title YAML front matter, so your title can be written correctly.

Also, don’t forget to add lang=fr-CA (your own), because screen reader and CSS will behave differently (W3C lang tag, w.r.t. CSS and Intl). I can give more info about Internationalization, but I went overboard already =)

I am on Windows. So this is may not really be a Nuxt or Nuxt Content issue, more of a systems issue.
That's good, thanks for taking your time and answering! :)

Was this page helpful?
0 / 5 - 0 ratings