When entering text in Cyrillic in the authorization form, is it possible to immediately convert and write the text in the database in Latin?
- better do it on the client. sql has no such ready-made functions, and changing one by one letter too large a query will be released - Mike
- More? - 0x00
|
1 answer
If you really need to do this in MySQL, you will have to create a character transcode table like this:
create table translit( rus varchar(1), eng varchar(3) ) default charset utf8; insert into translit(rus, eng) values('А','A'),('Б','B'),('В','V'),('Щ','Sch'),('Я','Ya'); then, to transcode a single line, use the following query:
select result from ( select @test:=replace(@test, rus, eng) result, @cnt:=@cnt+1 num from translit, (select @cnt:=0, @test:='ЩАВЕЛЬ') s ) X where num=(select count(1) from translit) But most likely it will be much easier to do this in the client language, before being sent to the database. To search for an example in the language you need in Google, you must enter "LANGUAGE Translite" (where LANGUAGE is the programming language you use)
- The problem is that when recording from the authorization form, everything is displayed normally, but when sent to telegrams, everything goes to ???? signs. - 0x00
- @ 0x00 then apparently it is necessary to solve the problem with the encoding, and not to do transliteration. But you asked how exactly to do transliteration using MySQL, this answer says exactly that. - Mike
|