Bug #1594: preg_* doesn't use locale
| From: | runesk at radar dot no | Date: | Thu, 24 Jun 1999 10:50:04 +0000 |
| Subject: | Bug #1594: preg_* doesn't use locale | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-7496@lists.php.net to get a copy of this message | ||
From: runesk@radar.no
Operating system: RedHat Linux 6.0 kernel 2.2.5
PHP version: 3.0.9
PHP Bug Type: Misbehaving function
Bug description: preg_* doesn't use locale
It seems like preg_* doesn't use the locale setting.
<?php
setlocale("LC_ALL", "no_NO");
$str = "æøå";
if(preg_match("/\w{3}/", $str, $foo)) {
echo "matched \\w{3}\n";
}
if(preg_match("/æøå/", $str, $foo)) {
echo "matched æøå\n";
}
?>
_Should_ match both tests, but only matches the last one.
#!/usr/bin/perl
use locale;
$_ = "æøå";
if(/\w{3}/) {
print "matched \\w{3}\n";
}
if(/æøå/) {
print "matched æøå\n";
}
matches both tests.
Rune N. Skillingstad