I'm working on a UTF-8 Persian website with integrated mysql database. All the content in the website are imported through an admin panel and it's all persian.
As you might know arabic language has the same letters as persian except some.
The problem is when a person tries to type on a keyboard with arabic layout it writes "ي" as an character and if he tries to type by a keyboard with persian layout it types "ی" as character.
So if a person searches for 'بازی' the mysql won't find 'بازي' as the result.
Important Note: 'ی' is not the only character with this property, there are lots of them and they are very similar.
How can I fix this issue?
One simple naive solution seems to be replace all "ي" with "ی" before importing the data into database, but i'm searching for a better robust solution than this.
Dear EBAG, We have a single Arabic block in Unicode which contains both Arabic & Persian characters.
06CC is Persian
ی and 064A is Arabic
Default windows keyboard uses
code page 1256 for arabic characters which put
064A as default
ي for bothPersian and Arab users because Arab users are much more than Persian.
ISIRI make an standard keyboard
ISIRI 9147 and put both Arabic and Persian
Yeh on it but Perisan
ی is the default characters. Persian users which are using standard keyboard will put ( and use ) standard Persian
ی while the rest of them use arabicي`.
As you told usually while we are saving a data to database we change arabic
ي to Persian
ی and when we are reading from it we just go for Persian so everything is true.
English and then in
the Third approach is to use a On-Screen Keyboard that work just like the previous one with a user interface and is usually good for thise who are not familiar with Persian keyboard.
The forth approach is to search both dialect. As you know when you install
SQL Server you can set the
collation and also you have an option to support dialect ( and case sensivity). if you enable arabic collation with dialect you can get result for both of them and usually this works fine in
sql server I don't test it in
MySql. This is the best solution yet.
but if I were you, I implement a simple
sql function which get
nvarchar and return
nvarchar. then I call it when I wanted to write data. and whenever you want to read, you can go for the standard one.
Sorry for the long tail.