php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37791 setlocale doesn't change behaviour of [:alpha:]
Submitted: 2006-06-12 19:29 UTC Modified: 2006-06-12 21:37 UTC
From: john at jcoppens dot com Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 5.1.4 OS: Linux (2.6.14)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: john at jcoppens dot com
New email:
PHP Version: OS:

 

 [2006-06-12 19:29 UTC] john at jcoppens dot com
Description:
------------
Executing

  setlocale(LC_ALL, 'es_ES');          
  $str = "La naci?n es grande";
  $words = split("[^[:alpha:]']+", $str);

words in $str are not recognized as Spanish. For example,
'naci?n' is still split at the '?'.

setlocale returns es_ES indicating the locale was set.


Expected result:
----------------
The original text split into correct words. According to the
regexp docs, [:alpha:] should acquire the Spanish characters
if the locale is set.

Actual result:
--------------
Words are split at non-ASCII characters (??? etc).


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-12 19:43 UTC] judas dot iscariote at gmail dot com
Hi:
You just rediscovered that PHP 5 doesn't support Unicode...
Unicode support will be available in PHP6 and up.
in the meanwhile check :

http://cl2.php.net/manual/en/function.mb-split.php


this is actually. not a bug.

Saludos ;-)
 [2006-06-12 21:37 UTC] nlopess@php.net
use preg_split() instead.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 09:01:26 2025 UTC