Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cyrillic search

I modified one of the apps I made for russian market. Everything seemed to be fine, there was an issue when you enter data into database but it was solved by by setting page encoding to utf-8. So inserting and retrieving works fine. I ran into problem I just have no idea how to tackle. When I ran following query (simplified) in mssql query analyser (so no chance that it got messed up in the code), I get no results even thought there are a number of records matching: (version of mysql is 2005)

SELECT *
FROM institutions
WHERE city LIKE '%Москва%'
ORDER BY address1

even if I modify it to be :

SELECT *
FROM institutions
WHERE city='Москва'
ORDER BY address1

or some other variation, it just isn't working. Question is why?

P.S. In case you can't see cyrillic letters after I submit this, it searches for Moscow as a city.

Anyone has solution or idea what to do?

like image 283
Zeljko Dakic Avatar asked Jan 21 '09 20:01

Zeljko Dakic


People also ask

How do you type in Cyrillic?

On the “Keyboards and Languages” tab, click on “Change Keyboards” > “Add” > “Russian.” 4. Expand the option of “Russian” and then expand the option “Keyboard.” Select the keyboard layout marked as “Russian.” You can ignore other keyboard layouts. Click “OK” and then “Apply.”

What is B in Cyrillic?

Be (Б б italics: Б б) is a letter of the Cyrillic script. It commonly represents the voiced bilabial plosive /b/, like the English pronunciation of ⟨b⟩ in "ball". It should not be confused with the Cyrillic letter Ve (В в), which is shaped like Latin capital letter B but represents the voiced labiodental fricative /v/.

Is Cyrillic and Russian the same?

Yes, it's Russian, but Russian isn't the only language to use this script. This script is called Cyrillic, and is used in many Slavic and Turkic languages. The most widely spoken languages that use Cyrillic script are: Russian, Serbian, Ukrainian, Bulgarian, Belarusian, Czech, Kazakh, Kirghiz, and Macedonian.

How do you Romanize in Russian?

The character e should be romanized ye initially, after the vowel characters a, e, ё, и, о, у, ы, э, ю, and я, and after й, ъ, and ь. In all other instances, it should be romanized e. The character ё is considered the 7th character of the Russian alphabet; however, the dieresis is generally not shown in writing.


2 Answers

OK just found answer and it is lame :) a little. You need to add N in front of unicode string.

SELECT * FROM institutions WHERE city LIKE N'%Москва%' ORDER BY address1

I will leave this in case someone else get stuck with it.

like image 74
Zeljko Dakic Avatar answered Oct 06 '22 01:10

Zeljko Dakic


The N tells SQL Server that it is unicode not ascii

like image 43
SQLMenace Avatar answered Oct 06 '22 00:10

SQLMenace