From: Jeff King Date: Sat, 29 Mar 2008 08:49:48 GMT Subject: Re: [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters Message-ID: <20080329084947.GB19200@coredump.intra.peff.net> In-Reply-To: <200803290941.54091.robin.rosenberg.lists@dewire.com> On Sat, Mar 29, 2008 at 09:41:53AM +0100, Robin Rosenberg wrote: > > 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. Does that work? I would think you would have to compare the normalized versions of each string, since decode(encode($x)) is not, AIUI, guaranteed to produce $x. -Peff