Re: "use utf8" in Locale::Maketext

[email protected] (Richard Evans) Fri, 06 Jun 2003 14:37:06 +0000
Newsgroups perl.i18n
Message-ID <[email protected]>
Sean M. Burke wrote:

> Jouke Visser, a fellow Locale::Maketext user, pointed out that if I added
> a "use utf8" to Maketext.pm, it would fix Maketext's dealings with utf8
> data.
> 
> Would anyone object if I went and added the "use utf8;" to the start of
> Maketext.pm?  Clearly the problem would be that users with Perls
> pre-dating utf8.pm wouldn't be able to use Maketext then.
> 
> I figure since this list has (I think) several people responsible for
> Maketext-based systems, it's a good place to talk about this.
> --
> Sean M. Burke    http://search.cpan.org/~sburke/

Hi Sean,

I've had exactly this problem with the DateTime::Locale stuff I'm doing.

Having talked to a few folks about it, the answer was actually dead simple:

  BEGIN
  {
    return unless $] >= 5.006;

    require utf8; "utf8"->import;
  }

I've tested it with perl 5.8, 5.6 and a 5.5 nsperl (can't remember the exact
release off hand).

Cheers,
Rich
-- 
Richard Evans
[email protected]