Skip to content

Commit

Permalink
HTML header charset changed from ISO-8859-1 to UTF-8 (#2547)
Browse files Browse the repository at this point in the history
* html header charset change from iso-8859-1 to utf-8
* mkhtml: remove py2 code

Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
  • Loading branch information
landam and wenzeslaus committed Aug 29, 2022
1 parent 1a4311b commit 17fc1d8
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 55 deletions.
2 changes: 1 addition & 1 deletion db/drivers/mysql/grass-mesql.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<title>GRASS-MySQL embedded driver - GRASS GIS manual</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
</head>
<body bgcolor="white">
Expand Down
2 changes: 1 addition & 1 deletion general/g.setproj/g.setproj.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<title>g.setproj - GRASS GIS manual</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
</head>
<body bgcolor="white">
Expand Down
2 changes: 1 addition & 1 deletion lib/gis/parser_html.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void G__usage_html(void)
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
fprintf(stdout, "<html>\n<head>\n");
fprintf(stdout,
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n");
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n");
fprintf(stdout, " <title>%s - GRASS GIS manual</title>\n", st->pgm_name);
fprintf(stdout, " <meta name=\"description\" content=\"%s", st->pgm_name);
if (st->module_info.description)
Expand Down
2 changes: 1 addition & 1 deletion lib/vector/rtree/docs/sources.htm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="GENERATOR" content="Mozilla/4.77 [en] (Win95; U) [Netscape]">
<meta name="Author" content="Daniel Green">
<meta name="resource-type" content="document">
Expand Down
4 changes: 2 additions & 2 deletions macosx/app/build_html_user_index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
<head>
<title>$2</title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
<meta name=\"Author\" content=\"GRASS Development Team\">" > $1
if [ "$3" ] ; then
echo " <meta name=\"AppleTitle\" content=\"$2\">
Expand Down Expand Up @@ -175,7 +175,7 @@ echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
<head>
<title></title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
<meta http-equiv=\"Refresh\" content=\"0; $GISBASE/docs/html/$i.html\">
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion man/build_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
r"""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>${title} - GRASS GIS Manual</title>
<meta name="Author" content="GRASS Development Team">
"""
Expand Down
2 changes: 1 addition & 1 deletion raster/r.li/r.li.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<title>r.li - GRASS GIS manual</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
</head>
<body bgcolor="white">
Expand Down
2 changes: 1 addition & 1 deletion raster3d/r3.showdspf/r3.showdspf_opengl_mods.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>modifications made to <em>r3.showdspf</em></title>
<link rel="stylesheet" href="grassdocs.css" type="text/css">
</head>
Expand Down
53 changes: 8 additions & 45 deletions utils/mkhtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,11 @@
import subprocess
import time

try:
# Python 2 import
from HTMLParser import HTMLParser
except ImportError:
# Python 3 import
from html.parser import HTMLParser
from html.parser import HTMLParser

from six.moves.urllib import request as urlrequest
from six.moves.urllib.error import HTTPError, URLError

try:
import urlparse
except ImportError:
import urllib.parse as urlparse
from urllib import request as urlrequest
from urllib.error import HTTPError, URLError
import urllib.parse as urlparse

try:
import grass.script as gs
Expand All @@ -56,15 +47,6 @@
}
HTTP_STATUS_CODES = list(http.HTTPStatus)

if sys.version_info[0] == 2:
PY2 = True
else:
PY2 = False


if not PY2:
unicode = str


grass_version = os.getenv("VERSION_NUMBER", "unknown")
trunk_url = ""
Expand All @@ -88,21 +70,6 @@ def _get_encoding():
return encoding


def decode(bytes_):
"""Decode bytes with default locale and return (unicode) string
No-op if parameter is not bytes (assumed unicode string).
:param bytes bytes_: the bytes to decode
"""
if isinstance(bytes_, unicode):
return bytes_
if isinstance(bytes_, bytes):
enc = _get_encoding()
return bytes_.decode(enc)
return unicode(bytes_)


def urlopen(url, *args, **kwargs):
"""Wrapper around urlopen. Same function as 'urlopen', but with the
ability to define headers.
Expand Down Expand Up @@ -399,7 +366,7 @@ def get_last_git_commit(src_dir, addon_path, is_addon):
header_base = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>${PGM} - GRASS GIS Manual</title>
<meta name="Author" content="GRASS Development Team">
<meta name="description" content="${PGM}: ${PGM_DESC}">
Expand Down Expand Up @@ -482,13 +449,9 @@ def get_last_git_commit(src_dir, addon_path, is_addon):

def read_file(name):
try:
f = open(name, "rb")
s = f.read()
f.close()
if PY2:
return s
else:
return decode(s)
with open(name) as f:
s = f.read()
return s
except IOError:
return ""

Expand Down
2 changes: 1 addition & 1 deletion utils/module_synopsis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ cat <<EOF >"${TMP}.html"
<html>
<head>
<title>$(g.version | cut -f1 -d'(') Command list</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
</head>
<body bgcolor="white">
Expand Down

0 comments on commit 17fc1d8

Please sign in to comment.