Re: Regexp help (simple)

From: Date: Thu, 22 Jan 2004 09:40:13 +0000
Subject: Re: Regexp help (simple)
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-175408@lists.php.net to get a copy of this message
Victor Spång Arthursson wrote:
Have been playing around a bit with this code, but I can't get it to work with international characters… For example, if I feed my function:
    function split_bokid($bokid)
    {
        if  (preg_match('/^([a-zåäö]{2,3})([0-9]{4,5}(\-[0-9]{1,2}){0,1})$/ i',$bokid,$m='')) {
            return $m;
        }
        else
        {
            return false;
        }
    }
returns, with the following code:
    $test = split_bokid("ääö123");
I assume you mean: $test = split_bokid("ääö12345");
    echo $test[1];
    echo $test[2];
the values:
    ŠŠš
     12345
So, is there any way I can set the encoding on the incoming values, which will come from url's and databases, so that they don't fuck up?
I don't know. It works fine on my computer. The letters display correctly on the command line and even in Mozilla.

« previous php.general (#175408) next »