Bug #14655 Updated: ucwords failing randomly with international characters
| From: | martin at humany dot com | Date: | Tue, 22 Jan 2002 13:03:42 +0000 |
| Subject: | Bug #14655 Updated: ucwords failing randomly with international characters | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-77763@lists.php.net to get a copy of this message | ||
ID: 14655
Comment by: martin@humany.com
Old Reported By: xtango@netcombbs.com.ar
Reported By: martin@humany.com
Status: Open
Bug Type: Strings related
Operating System: Windows XP Pro (spanish)
PHP Version: 4.1.0
New Comment:
Some additional comments:
I cant reproduce this in Linux (meaning the returned data doesnt
change), but with PHP 4.1.1 in Window XP the problem exists, but only
when i change locale, my default locale is:
LC_COLLATE=C;LC_CTYPE=English_United
States.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C
and the output here is:
ÑÁéÍóúàèìòùäëÏöÜ
With linux:
Ñáéíóúàèìòùäëïöü
But if i change locale with:
setlocale(LC_ALL, "english");
(Locale: English_United States.1252)
The returned data differs at each function call
Previous Comments:
------------------------------------------------------------------------
[2001-12-23 15:51:45] venaas@php.net
To me this sounds like a system problem. PHP only uses the
systems notion of upper and space. When the character
following the international character it is probably
because the international character is treated as a
space by the system (isspace() returning true). It's quite
weird that the results are not consistent. The PHP function
itself is quite straightforward, so I suspect the locale is
not the same every time, or that the systems isspace() and
possibly toupper() is broken. I can't say for sure though.
------------------------------------------------------------------------
[2001-12-21 22:32:30] xtango@netcombbs.com.ar
When using the ucwords() function with strings containing international
characters, the function will return incorrect values. The return value
will be different every time the function is called.
I've seen bogus bug reports for this function so we have a slight
chance for this to be yet another bogus bug, but look at this:
echo setlocale(LC_ALL, "0");
Output:
LC_COLLATE=C;LC_CTYPE=Spanish_Argentina.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C
---
echo ucwords('ñáéíóúàèìòùäëïöü');
Output:
ÑáéíóúÀèìÒùäËïÖü
Output again (refresh button on browser):
ÑáÉíóúàèìòùäëïöÜ
Output again:
ÑáéíÓúàèìÒùäëïöÜ
etc. etc.
Now, if I do setlocale(LC_ALL, "spanish"), the restult is still the
same.
I've noted that the problem is not the intl. char, but the char after
that. This is, ucwords("cañas") will return "Cañas" or "CañAs",
randomly.
Scenario:
Windows XP Pro (spanish)
Apache 1.3.22
PHP 4.1.0
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14655&edit=1