in reply to Re: utf8, locale and regexp
in thread utf8, locale and regexp
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: utf8, locale and regexp
by ikegami (Patriarch) on Apr 10, 2007 at 15:32 UTC | |
Replacing use encoding 'UTF-8'; with use encoding 'utf8'; yields the same results. Replacing use encoding 'UTF-8'; with use utf8; produces the same dumps, but the matches succeed. My suggestion:
| [reply] [d/l] [select] |
by Krambambuli (Curate) on Apr 11, 2007 at 08:41 UTC | |
your code seems to rather clearly bring to light a bug with the 'encoding' pragma. Did you maybe try to submit it to the author of the 'encoding.pm' module ? Seems to be Dan Kogai, an e-mail (don't know if valid) is available on CPAN. | [reply] |
by Anonymous Monk on Apr 10, 2007 at 16:47 UTC | |
| [reply] [d/l] [select] |
by Joost (Canon) on Apr 10, 2007 at 19:48 UTC | |
The only reason use utf8 / use encoding "utf8" fixes the problem is because eval STRING will then assume any string passed to it is utf-8 encoded even if the string that's eval()d isn't marked as utf-8. That is arguably not even correct behaviour - I would definitely argue it's a bug.
update: all the above is interesting, but not correct since the CGI::FastTemplate documentation claims it doesn't use eval(). updat2: I still think there's NEVER any reason to use both utf8 and encoding "utf8" at the same time. They are more or less equivalent anyway. Please try using either one or the other and see if that fixes your problem. Using both does cause problems, as you can see. Also, if at all possible, the best solution would be to patch CGI::FastTemplate to open the template files with the correct IO layer instead of relying on this ugly hack - (maybe you can open the template files yourself, set the binmode and pass the filehandle/filecontent to CGI::FastTemplate yourself? that might also fix the issue) | [reply] [d/l] |
by ikegami (Patriarch) on Apr 10, 2007 at 17:08 UTC | |
Well, that's another problem. Maybe you should start a new thread instead of leaving it buried this deep in this thread?
"which is enabled with use encoding 'utf8'" is untrue. use encoding has nothing to do with it.
I only removed it because it was irrelevant to the question I was addressing. Feel free to re-add it. | [reply] [d/l] [select] |