Re: [Patch] Improve replying to html-only messages



Am 20.01.18 16:11 schrieb(en) Albrecht Dreß:
attached is a little patch which improves replying to html-only messages containing national characters.  It 
turns out that html2markdown reliably converts such characters to utf-8 only if an extra command line option 
is given.  As we check for a “zoo” of conversion tools, the configure script verifies that the selected one 
does actually accept the extra option.

Unfortunately, I have no idea how the change should be added to the meson build, so it would be great if 
someone could have a look at it.

O.k., this seems to be a little complex, as I did not find a way to simply create and erase a file from 
meson.  The recommended (?) way seems to be writing a shell script for that purpose…  not really portable!  
Anyone knows a better way?

The meson part is then simple.  Attached is patch which shall go on top of the first one, and /should/ detect 
if the extra command line option is accepted.  Unfortunately, I can not build the result, as Ninja is too old 
on Ubuntu LTS.

Cheers,
Albrecht.
diff --git a/check_htmlconv.sh b/check_htmlconv.sh
new file mode 100755
index 0000000..a7c26e5
--- /dev/null
+++ b/check_htmlconv.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+echo "<html/>" > conftest.htm
+$@ conftest.htm
+R=$?
+rm -f conftest.htm
+exit $R
+
diff --git a/meson.build b/meson.build
index c6fc2ae..4cc3a88 100644
--- a/meson.build
+++ b/meson.build
@@ -218,6 +218,11 @@ elif html_widget == 'webkit' or html_widget == 'webkit2'
   if html2text.found()
     conf.set_quoted('HTML2TEXT', html2text.path(),
       description : 'Path to html2text program.')
+    r = run_command('check_htmlconv.sh', html2text.path(), '--unicode-snob')
+    if r.returncode() == 0
+      conf.set('HTML2TEXT_UCOPT', 1,
+        description : 'Defined when the HTML converter accepts the --unicode-snob option.')
+    endif
   else
     message('You cannot properly quote html-only messags.')
   endif

Attachment: pgpXEq8en2heP.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]