Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Do you whitelist or blacklist utf-8?
- Date: Thu, 24 Feb 2011 10:02:41 +0900
- From: Darren Cook <darren@example.com>
- Subject: Re: [tlug] Do you whitelist or blacklist utf-8?
- References: <4D639689.1010302@example.com> <4D63EFBC.1020900@example.com> <4D64C5DD.1040607@example.com> <4D64CB49.10906@example.com> <4D652AF5.10304@example.com> <AANLkTikZsrW+CKHRG-wQUUVZE8Yy-B1eBZD2vGESFxfa@example.com>
- User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7
> ^[\p{L}\p{N}\p{Z}]$ > > This is assuming that PHP's regex engine can handle the POSIX attributes. PHP uses PCRE under the covers, and does support them: http://jp.php.net/manual/en/regexp.reference.unicode.php You have to add the /u modifier at the end of your regex. Also, note the last comment (from Mar 2010, so quite recent): ...only available if PCRE is compiled with "--enable-unicode-properties" I've no idea how widespread an issue that is; at least on Ubuntu 10, Centos 5 and Xampp (a windows WAMP installation) it works fine. Here is my simple test script, which outputs "100" (i.e. true, false, false): echo preg_match('/^\p{L}+$/u', '日本語'); echo preg_match('/^\p{L}+$/u', '<b>日本語</b>'); echo preg_match('/^\p{Sm}+$/u', '日本語'); Darren P.S. Josh, regarding your other comment: >> Surely if any language had MySQL syntax constructors it would be PHP.... > Surely you were being sarcastic... ;-P Not at all: MySQL and PHP go together like fish 'n' chips (c.f. LAMP), so Dave's point was that if PHP didn't support something useful in MySQL one of the millions of users would have added it very quickly. In comparison, practically no-one uses the C API ;-) (He says, lighting the fuse on the Language Wars bomb, then standing well back...) -- Darren Cook, Software Researcher/Developer http://dcook.org/work/ (About me and my work) http://dcook.org/blogs.html (My blogs and articles)
- References:
- [tlug] Do you whitelist or blacklist utf-8?
- From: Dave M G
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Shmuel Fomberg
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Dave M G
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Shmuel Fomberg
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Dave M G
- Re: [tlug] Do you whitelist or blacklist utf-8?
- From: Josh Glover
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] cacert question
- Next by Date: Re: [tlug] Do you whitelist or blacklist utf-8?
- Previous by thread: Re: [tlug] Do you whitelist or blacklist utf-8?
- Next by thread: Re: [tlug] Do you whitelist or blacklist utf-8?
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links