send charset=utf8 for css, js files

This commit is contained in:
ed 2021-06-25 02:10:42 +02:00
parent e0a14ec881
commit 177aa038df
2 changed files with 8 additions and 2 deletions

View file

@ -1030,7 +1030,13 @@ def guess_mime(url, fallback="application/octet-stream"):
except:
return fallback
return MIMES.get(ext) or mimetypes.guess_type(url)[0] or fallback
ret = MIMES.get(ext) or mimetypes.guess_type(url)[0] or fallback
if ";" not in ret:
if ret.startswith("text/") or ret.endswith("/javascript"):
ret += "; charset=UTF-8"
return ret
def runcmd(*argv):

View file

@ -1664,7 +1664,7 @@ document.onkeydown = function (e) {
if (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey || e.isComposing)
return;
var k = (e.code + ''), pos = -1;
var k = (e.code + ''), pos = -1, n;
if (k.indexOf('Digit') === 0)
pos = parseInt(k.slice(-1)) * 0.1;