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

Top Page
Delete this message
Reply to this message
Author: Jakob Hirsch
Date:  
To: exim-users
Subject: Re: [exim] error with exim conf - Unicode UTF-8 with BOM
Heiko Schlittermann, 2011-02-13 14:07:
> + if (config_lineno == 1 && Ustrstr(s, "\xef\xbb\xbf") == s)


I would generalize that: A byte value > 0x7f at this point means, that
there's something wrong. So I'd prefer something like this:

if (config_lineno == 1 && (s[0] < 0x20 || s[0] > 0x7e ))

(with logging something like "invalid char '%hhc' at start of config file").

This would catch all cases listed in
http://en.wikipedia.org/wiki/Byte-order_mark#Representations_of_byte_order_marks_by_encoding,
except "UTF-32 (BE)" (which is hard to handle with it's starting 0
octet, as we don't know the line length), but I guess that's good enough
(or at least better that what we have right now).