Commit 4933a893171c9b1befdc64c55d8b7fc649fe11f2

Martin Mitas 2024-01-25T20:28:54

md2html: Add <meta charset="UTF-8"> with output with --full-html. Fixes #231.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/md2html/md2html.c b/md2html/md2html.c
index 86c5bb7..57baa82 100644
--- a/md2html/md2html.c
+++ b/md2html/md2html.c
@@ -193,6 +193,9 @@ process_file(const char* in_path, FILE* in, FILE* out)
         fprintf(out, "<head>\n");
         fprintf(out, "<title>%s</title>\n", html_title ? html_title : "");
         fprintf(out, "<meta name=\"generator\" content=\"md2html\"%s>\n", want_xhtml ? " /" : "");
+#if !defined MD4C_USE_ASCII && !defined MD4C_USE_UTF16
+        fprintf(out, "<meta charset=\"UTF-8\"%s>\n", want_xhtml ? " /" : "");
+#endif
         if(css_path != NULL) {
             fprintf(out, "<link rel=\"stylesheet\" href=\"%s\"%s>\n", css_path, want_xhtml ? " /" : "");
         }