From: Robin Rosenberg Date: Sat, 29 Mar 2008 08:41:53 GMT Subject: Re: [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters Message-ID: <200803290941.54091.robin.rosenberg.lists@dewire.com> In-Reply-To: <20080329072203.GA17625@coredump.intra.peff.net> Den Saturday 29 March 2008 08.22.03 skrev Jeff King: > On Sat, Mar 29, 2008 at 08:19:07AM +0100, Robin Rosenberg wrote: > > Den Friday 28 March 2008 22.29.01 skrev Jeff King: > > > We always use 'utf-8' as the encoding, since we currently > > > have no way of getting the information from the user. > > > > Don't set encoding to UTF-8 unless it actually looks like UTF-8. > > OK. Do you have an example function that guesses with high probability > whether a string is utf-8? If there are non-ascii characters but we > _don't_ guess utf-8, what should we do? Any test for valid UTF-8 will do that with a very high probability. The perl UTF-8 "api" is a mess. I couldn't find such a routine!?. Calling decode/encode and see if you get the original string works, but that is too clumsy, IMHO. -- robin