in reply to Re: utf8, locale and regexp
in thread utf8, locale and regexp

I need the use encoding 'utf8' plumbering to make CGI and CGI::FastTemplate work properly with utf8 pages. I need the locale support since I'm using my locale collation. But:
#!/usr/bin/perl use strict; use utf8; use encoding 'utf8'; my $test = "État"; my $test2 = "É"; if ($test =~ /$test2/) {print "$test matches $test2\n"} else {print "d +oes not matches\n"}
does not work either. use encoding 'utf8'; seems enought to screw the regexp engine.

Replies are listed 'Best First'.
Re^3: utf8, locale and regexp
by Joost (Canon) on Apr 10, 2007 at 15:51 UTC
    I need the use encoding 'utf8' plumbering to make CGI and CGI::FastTemplate work properly with utf8 pages.
    As I pointed out above, there should be no need to use either utf8 or encoding "utf8" if your code and string literals are not utf-8 encoded - if all the code opens the template files with the right settings.

    I'm going to blame CGI::FastTemplate, since I highly doubt it opens unicode templates using the utf-8 layer. If it did there would be no need to use any of the encoding modules.

    use utf8; use encoding 'utf8';
    There should be no need to use encoding "utf8" when you already do a use "utf8"; As I said above. In fact they seem to break each other. As far as I know "use utf8" is the more standard of the two. If you want to have utf8-encoded scripts, you should probably use (only) utf8;.