. , . , - .
3 :
, MySQL. .
1.
, MySQL . Index.xml, . , information_schema :
SHOW VARIABLES LIKE 'character_sets_dir';
, , <charset name="utf8″>, xml:
<charset name="utf8">
.
.
.
<collation name="utf8_arabic_ci" id="1029">
<rules>
<reset>\u0627</reset>
<i>\u0623</i>
<i>\u0625</i>
<i>\u0622</i>
</rules>
<rules>
<reset>\u0629</reset>
<i>\u0647</i>
</rules>
<rules>
<reset>\u0000</reset>
<i>\u064E</i>
<i>\u064F</i>
<i>\u0650</i>
<i>\u0651</i>
<i>\u064F</i>
<i>\u064B</i>
<i>\u064C</i>
<i>\u064D</i>
</rules>
</collation>
</charset>
xml , utf8, utf8_arabic_ci id 1029, 1024-2047. , MySQL , . , . MySQL documentemntation .
MySQL :
ALTER TABLE persons MODIFY name VARCHAR(50)
CHARACTER SET 'utf8' COLLATE 'utf8_arabic_ci';
"اسامة" "اسامة", "أسامه", "أسامة" ..
2.
. "", :
id normalized_name name
1 احمد احمد
2 أحمد احمد
3 أسامه اسامة
4 أسامة اسامة
5 اسامه اسامة
6 اسَامه اسامة
, "", , . , , . - :
SELECT name FROM persons WHERE normalized_name = "اسامة";
+
| name |
+
| أسامه |
| أسامة |
| اسامه |
| اسَامه |
+
3.
, , , . .
REGEX RLIKE MySQL. , "أحمد" Alef, , :
SELECT name FROM clients WHERE name REGEXP 'ا|أ|إ]حمد]'
, , , . , , :
$patterns = array( "/(ا|أ|آ)/", "/(ه|ة)/" );
$replacements = array( "[ا|أ|آ]", "[ة|ه]" );
$query_string = preg_replace($patterns, $replacements, $search_string);
, , .
, . , , , (, , ), , .