Re: [exim] error with exim conf - Unicode UTF-8 with BOM

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Heiko Schlittermann
Date:  
À: exim-users
CC: Brian Blood
Sujet: Re: [exim] error with exim conf - Unicode UTF-8 with BOM
Phil Pennock <exim-users@???> (Sun Feb 13 05:09:41 2011):
> On 2011-02-12 at 21:01 -0600, Brian Blood wrote:
> > FYI, exim 4.74 chokes when there is a Byte Order Marker at the beginning of the exim conf file.
>
> I think it's fair to say that Exim uses an ASCII encoding. Unless and
> until we move to full unicode support in the config file, it would be
> premature to accept a BOM.
>
> In fact, since you see an 0xFEFF sequence at the start, the BOM has done
> part of what it's supposed to do: let an ASCII system reject the config
> file early and clearly, instead of having to deal with every other octet
> being a NUL.
>
> If you'd like, you could file a feature request at bugs.exim.org,
> requesting Unicode support for reading the config file. I suspect that
> we'll opt to mandate UTF-8, so the BOM (if present) would need to be
> 0xEFBBBF anyway.


Can't we do:

diff -r 2ce70237f5bf src/readconf.c
--- a/src/readconf.c    Sun Feb 13 10:31:31 2011 +0100
+++ b/src/readconf.c    Sun Feb 13 12:04:29 2011 +0100
@@ -2906,6 +2906,11 @@


 while ((s = get_config_line()) != NULL)
   {
+
+  if (config_lineno == 1 && Ustrstr(s, "\xef\xbb\xbf")) 
+    log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, 
+      "Byte Order Mark found (config file should be plain ASCII) <%d>", config_lineno);
+
   if (isupper(s[0])) read_macro_assignment(s);


else if (Ustrncmp(s, "domainlist", 10) == 0)

to avoid spending hours in finding the invisible BOM, if the editor put
it there? (As I had already the same issue.)

--
Heiko :: dresden : linux : SCHLITTERMANN.de
GPG Key 48D0359B : 3061 CFBF 2D88 F034 E8D2 7E92 EE4E AC98 48D0 359B