commit 668316e6e168e23ebd105cf7e58f31edb55262b9
Author: Dan Gildea <dgildea>
Date:   Tue Feb 19 09:07:06 2019 -0500

    fix unicode in -html_version 5.0,math
    
    Fixes #52

diff --git a/Changes b/Changes
index 201e4df..ee2cba5 100644
--- a/Changes
+++ b/Changes
@@ -112,6 +112,7 @@
 # A more detailed log history can be found within the particular files, near
 # the top.
 #
+#		- fix unicode in -html_version 5.0,math
 #		- fix -notop_navigation (had no effect)
 #
 #--------- v2019
diff --git a/latex2html.pin b/latex2html.pin
index 4e8cd30..1c3d6d4 100755
--- a/latex2html.pin
+++ b/latex2html.pin
@@ -9736,7 +9736,8 @@ sub revert_to_raw_tex {
     local($_) = @_;
     local($character_map) = "";
     if ( $CHARSET && $HTML_VERSION ge "2.1" ) {
-	$character_map = $CHARSET;
+	$character_map = ((($CHARSET =~ /utf/)&&!$NO_UTF)?
+			  'iso_10646' : $CHARSET );
 	$character_map =~ tr/-/_/; }
     while (s/$O\s*\d+\s*$C/\{/o) { s/$&/\}/;}
     while (s/$O\s*\d+\s*$C/\{/o) { s/$&/\}/;} #repeat this.
diff --git a/tests/math_unicode.tex b/tests/math_unicode.tex
new file mode 100644
index 0000000..1084eb5
--- /dev/null
+++ b/tests/math_unicode.tex
@@ -0,0 +1,26 @@
+% test unicode symbols in formulas and in file names from section headings
+% latex2html -long_titles 20 -html_version 5.0,math math_unicode.tex
+
+\documentclass{article}
+
+\begin{document}
+
+
+\section{The symbol $\alpha$}
+
+This should be in the file \texttt{symbol\_alpha.html}.$\alpha$
+
+test unicode beta: β
+
+\'e
+
+\section{The symbol $\beta$}
+
+This should be in the file \texttt{symbol\_beta.html}. $\beta = 1 + a \ldots$
+
+\section{\textit{Another} section}
+
+This should be in the file \texttt{symbol\_beta.html}.$\beta$
+
+\end{document}
+
diff --git a/versions/math.pl b/versions/math.pl
index 00fd1b4..dc2942f 100644
--- a/versions/math.pl
+++ b/versions/math.pl
@@ -907,7 +907,7 @@ sub do_env_array {
 
 ### Delimiters
 
-$math_delimiters_rx = "^\\s*(\\[|\\(|\\\\{|\\\\lfloor|\\\\lceil|\\\\langle|\\/|\\||\\)|\\]|\\\\}|\\\\rfloor|\\\\rceil|\\\\rangle|\\\\backslash|\\\\\\||\\\\uparrow|\\\\downarrow|\\\\updownarrow|\\\\Uparrow|\\\\Downarrow|\\\\Updownarrow|\\.)";
+$math_delimiters_rx = "^\\s*(\\[|\\(|\\\\\\{|\\\\lfloor|\\\\lceil|\\\\langle|\\/|\\||\\)|\\]|\\\\}|\\\\rfloor|\\\\rceil|\\\\rangle|\\\\backslash|\\\\\\||\\\\uparrow|\\\\downarrow|\\\\updownarrow|\\\\Uparrow|\\\\Downarrow|\\\\Updownarrow|\\.)";
 
 %ord_brackets = ( 'le' , '{', 're', '}', 'lk', '[', 'rk', ']' );
 
@@ -1986,11 +1986,13 @@ sub parse_math_toks {
 	    } elsif (($mathentities{$cmd})||($latexsyms{$cmd})) {
 		$ent = ($mathentities{$cmd} || $latexsyms{$cmd});
 		do {
-		    local($cset) = "${CHARSET}_character_map{$ent}";
+		    my $character_map = ((($CHARSET =~ /utf/)&&!$NO_UTF)?
+					 'iso_10646' : $CHARSET );
+		    local($cset) = "${character_map}_character_map{$ent}";
 		    $cset =~ s/\-/_/go;
 		    local($char); eval "\$char = \$$cset";
 		    do {
-			$cset = "${CHARSET}_character_map{$cmd}";
+			$cset = "${character_map}_character_map{$cmd}";
 			$cset =~ s/\-/_/go; eval "\$char = \$$cset";
 			$ent = $cmd if ($char);
 		    } unless ($char);
