HylaFAX The world's most advanced open source fax server

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

Re: [hylafax-users] More Questions on Email-to-Fax Gateway



Mufit Eribol wrote:
I am running hylafax-5.2.2-2 on CentOS 5.1. I created an entry in /etc/postfix/virtual, modified DNS records and added mail2fax.sh redirecting in /etc/aliases. This system works fine in general.

However, I have some problems and couldn't find an answer in the archive.

1. I think, plain text written in the body of the email (no html) is converted to ps using 8859-1 character code set. Some non-english characters come up corrupted in the fax. How can I change this default encoding?

Faxmail currently only supports two character sets: ASCII and ISO-8859-1. As long as you're using characters that match up with those in ISO-8859-1 then the attached patch will probably work "good enough" for you. However, I see that you're default character set is ISO-8859-9, and so it may not be enough.


Take a look at the util/TextFormat.c++ file...

http://hylafax.cvs.sourceforge.net/*checkout*/hylafax/hylafax/util/TextFormat.c%2B%2B

What I need is a version of the TextFormat::putISOPrologue function that is appropriate for ISO-8859-9. Then I can make a command-line switch for faxmail that will allow you to choose which character set to use (ISO-8859-9 or ISO-8859-1). You'll probably then want your mail2fax.sh script to scan the mail first for the proper character set so that it knows how to invoke faxmail. (Unfortunately faxmail does not currently have the ability to check for itself reliably... or switch character sets within a single mail message.)

2. html2ps (perl version) is also limited in terms of encoding. I would like to use html2ps (php version). It supports broad range encodings. However, I don't understand how it can be run from a mime converter script. What is the proper way of calling html2ps (php version) from "html" mime script?

If the statement on the html2ps PHP website, "This is a PHP equivalent to the popular Perl script by the same name." is entirely accurate as far as invocation is concerned, then this is what your faxmail/text/html MIMEConverter should probably look like:


#! /bin/sh
/usr/local/bin/html2ps $1
exit

Make sure that the file is marked as executable.

Thanks,

Lee.
--- hylafax.orig/faxmail/faxmail.c++	2008-03-12 06:07:18.000000000 -0700
+++ hylafax/faxmail/faxmail.c++	2008-03-26 04:38:00.111258728 -0700
@@ -434,8 +434,38 @@
     if (mime.parse(msg, emsg)) {
 	if (verbose)
 	    mime.trace(stderr);
-	// XXX anything but us-ascii is treated as ISO-8859-1
-	setISO8859(mime.getCharset() != CS_USASCII);
+	/*
+	 * In theory each MIME part could be in a different
+	 * character set, and each text mail header (such as
+	 * the subject header) could also be in multiple
+	 * character sets.  Supporting this would probably 
+	 * require faxmail to scan the entire mail beforehand
+	 * to add the requisite font definitions early in
+	 * the Postscript output... which isn't how faxmail
+	 * does things right now.
+	 *
+	 * Fortunately, the likelihood of a mail being written
+	 * in more than one character set (not including ASCII)
+	 * would be extremely rare and quite possibly only in
+	 * contrived scenarios.  So for now we just apply a single
+	 * character set to the entire mail message.
+	 *
+	 * In the past we did this:
+	 *
+	 * setISO8859(mime.getCharset() != CS_USASCII);
+	 *
+	 * However, this makes it impossible for RFC-2047-encoded
+	 * subject lines to show properly, as well as any 
+	 * subsequent non-ASCII mail parts.
+	 *
+	 * Eventually it may be best to have the character set 
+	 * be selected by a command-line argument, however, since
+	 * TextFormat.c++ only supports ISO-8859-1 at the moment
+	 * there is no point.  And since ASCII is completely 
+	 * covered by ISO-8859-1 there is no reason to prefer
+	 * ASCII over ISO-8859-1.
+	 */
+	setISO8859(true);
 
 	/*
 	 * Check first for any external script/command to



Project hosted by iFAX Solutions