Edit report at https://bugs.php.net/bug.php?id=60603&edit=1

 ID:                 60603
 Updated by:         cataphr...@php.net
 Reported by:        post at kira-bianca dot de
 Summary:            PCRE functions and encoding UTF-8
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            PCRE related
 Operating System:   Windows XP prof. V2002 with SP3
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------
[2011-12-23 23:13:36] post at kira-bianca dot de

Description:
------------
Hi!

My HTML source I write in the encoding UTF-8 and I have probably found a bug 
(... soon cost me two hours of searching and working for a flaw in my logic).

And indeed, I want with preg_match() a string to check for valid characters and 
simultaneously for a minimum length. In the string should german special 
characters (Ä, Ö, Ü, ß) also be allowed. As I noted, these are all PCRE 
functions treated as two letters, if the encoding is UTF-8. Examples see below.

For tips on how I can work around this problem, I would be grateful.

greeting
Ki-Bi

Test script:
---------------
/*
   remark:
   The source is saved with encoding UTF-8 (without BOM)
*/
$animal = 'Bär';
if (preg_match('~^[a-zäöüß\.\- ]{4,26}$~i', $animal)){
                echo "$animal has a word length from 4 to 26 letters.\n";
        }else{
                echo "$animal is too short or too long!\n";}
$string = 'Dörte hütet die Schäfchen und trinkt dabei ein Maß Bier. Ärger 
gibt es dabei nicht.';
echo preg_replace('~[äöüß]~i', '*', $string);

Expected result:
----------------
Bär has a word length from 4 to 26 letters.
D**rte h**tet die Sch**fchen und trinkt dabei ein Ma** Bier. *�rger gibt es 
dabei nicht.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60603&edit=1

Reply via email to