0

I'm doing a little home project that requires a simple file server from the current directory. I've found two good option in python and ruby, but my problem is the encoding isn't quite right. My files are HTML document text, Unicode text, UTF-8 text (file command)

But these server commands:

python3 -m http.server 8000

ruby -run -ehttpd . -p8000

are rendering things like this:

enter image description here

I suspect it's quiet easy to do what I want, and just pass a utf8 config somehow. Just not sure how...

Holger Just
  • 52,918
  • 14
  • 115
  • 123
pixelearth
  • 13,674
  • 10
  • 62
  • 110

1 Answers1

0

Ok, so this was easier than I thought, I just added these to the html:

  <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  <meta content="utf-8" http-equiv="encoding">
pixelearth
  • 13,674
  • 10
  • 62
  • 110
  • Where do you got `http-equiv="encoding"` from? It neither exists in [HTML4](https://www.w3.org/TR/1999/REC-html401-19991224/charset.html#h-5.2.2) nor [HTML5](https://www.w3.org/TR/2012/WD-html-markup-20121025/meta.html) and I've never encountered it in 20 years either. Also [linking `meta`](https://stackoverflow.com/q/4696499/4299358), unbound to UTF-8. – AmigoJack May 15 '22 at 08:38