diff --git a/rem2html/rem2html b/rem2html/rem2html
index 4ce194c5..6eba20db 100644
--- a/rem2html/rem2html
+++ b/rem2html/rem2html
@@ -6,6 +6,7 @@ use warnings;
use Getopt::Long;
use JSON::MaybeXS;
+use Encode;
my %Options;
@@ -44,6 +45,11 @@ Print usage information
Print version
+=item --utf8
+
+Assume standard input is encoded in UTF-8; write UTF-8 data to standard
+output.
+
=item --backurl I
When producing the small calendar for the previous month, make the
@@ -154,6 +160,7 @@ Usage: remind -pp ... | rem2html [options]
Options:
--help, -h Print usage information
+--utf8 Assume UTF-8 input and write UTF-8 output
--man Show man page (requires "perldoc")
--version Print version
--backurl url Make the title on the previous month's small calendar
@@ -197,6 +204,7 @@ sub parse_options
local $SIG{__WARN__} = sub { print STDERR "$TIDY_PROGNAME: $_[0]\n"; };
if (!GetOptions(\%Options, "help|h",
"man",
+ "utf8",
"pngs",
"version",
"stylesheet=s",
@@ -216,13 +224,22 @@ sub parse_options
if ($stylesheet) {
$Options{stylesheet} = smoosh($Options{imgbase}, $stylesheet);
}
+ if ($Options{utf8}) {
+ binmode(STDIN, ':encoding(UTF-8)');
+ binmode(STDOUT, ':encoding(UTF-8)');
+ }
}
sub start_output
{
return if ($Options{tableonly});
- print("\n\n" . $Options{title} . "\n");
+ print("\n\n");
+ if ($Options{utf8}) {
+ print '' . "\n";
+ }
+
+ print("" . $Options{title} . "\n");
if (!$Options{nostyle}) {
if ($Options{stylesheet}) {
print('