Convert output to user's locale charset.
Index: html2text/html2text.C
===================================================================
--- html2text.orig/html2text.C
+++ html2text/html2text.C
@@ -45,6 +45,8 @@
 
 #include <iconv.h>
 #include <errno.h>
+#include <unistd.h>
+#include <langinfo.h>
 
 #include "html.h"
 #include "HTMLControl.h"
@@ -59,6 +61,7 @@ using std::ifstream;
 using std::stringstream;
 using std::istream_iterator;
 using std::ostream_iterator;
+using std::noskipws;
 
 class MyParser : public HTMLControl {
 
@@ -429,8 +432,13 @@ main(int argc, char **argv)
   ostream  *osp;
   std::ofstream ofs;
 
+  bool output_is_tty = false;
   if (!strcmp(output_file_name, "-")) {
     osp = &std::cout;
+	if (isatty(1 /* stdout */))
+	{
+		output_is_tty = true;
+	}
   } else {
     ofs.open(output_file_name, std::ios::out);
     if (!ofs) {
@@ -476,7 +484,7 @@ main(int argc, char **argv)
 		uis = infile;
     }
 
-	*uis >> std::noskipws;
+	*uis >> noskipws;
 	std::copy(istream_iterator<char>(*uis), istream_iterator<char>(), ostream_iterator<char>(input_stream));
 
 	if (infile)
@@ -557,6 +565,8 @@ main(int argc, char **argv)
 		use_encoding = UTF8;
 	}
 
+	stringstream output_stream;
+
 	// real parsing
 	input_stream.clear();
 	input_stream.seekg(0);
@@ -564,13 +574,31 @@ main(int argc, char **argv)
 	  input_stream,
 	  debug_scanner,
 	  debug_parser,
-	  *osp,
+	  output_stream,
 	  mode,
 	  width,
 	  input_url
 	);
     if (parser.yyparse() != 0) exit(1);
 
+	// recode output if output is terminal
+	if (output_is_tty)
+	{
+		setlocale(LC_CTYPE,"");
+		char output_encoding[64];
+		strcpy(output_encoding, nl_langinfo(CODESET));
+		strcat(output_encoding, "//translit");
+
+		result = recode(output_stream, output_encoding, "UTF-8");
+		if (!result)
+		{
+			continue;
+		}
+	}
+	output_stream.clear();
+	output_stream.seekg(0);
+	output_stream >> noskipws;
+	std::copy(istream_iterator<char>(output_stream), istream_iterator<char>(), ostream_iterator<char>(*osp));
   }
 
   return 0;
