The copyright I want to place in my “robots.txt”
The heart in the “humans.txt”.
When I edit the files in the browser (dev console) and add the chars/emojis it works. This indicates I can place them into the files.
But every time I place them (as they are) in Hugo and generate the new files it breaks, and I end up with:
So I thought the problem things are not UTF-8 encoded is the isPlainText = true so I tried all combinations of isPlainText and isHTML. But did not succeed.
Did anyone manage it to place special chars into txt files and still having them displayed correct in the browser? Or is there a way to define the encoding for that file?
Thanks, then I will continue to search. May you are able to give me some deeper insights about that file?
What MimeType does it have? What is the configuration in Hugo for this file? Are you able to share a link to this file so I can inspect it?
My source looks like this:
/* NOTE */
Built with ❤ ❤ ❤.
… so I’ve tried multiple versions of the same special char.
But that obviously did not work. I think that is a lack of flexibility to not be able to set the charset/encoding directly.
As I did my search I noticed that the “solution” provided HERE just works for HTML, but will never work for textfiles as they dont have any header in the content itself.
Any other plans how toconfigurate this that it works?
I just clicked on “RAW” then GitHub gives you a web preview of the content: https://raw.githubusercontent.com/jmooring/hugo-testing/hugo-forum-topic-33052/layouts/index.humanstxt.txt
There everything is displayed correctly. I know… thats not generated with Hugo, but it works and the difference is the encoding in the header.
I dont have my setup running local, so I can not call this. Also I have all ports blocked beside the ones that are for web (80, 443)
But I have found the solution. I had to force my Nginx to set default to “UTF-8”. It was done with:
charset UTF-8;
Just added to the server, or location. Both would do the trick.
I apparently thought I have already done this, but have done it within the .htaccess and not the nginx.conf. But static files are getting served by Nginx on my setup.
Sorry for the trouble and thank you for the fast help!!