cyrillic in MySQL
#1

Hello guys!
Can you tell me please how to save cyrillic text in MySQL? I changed the collection to "cp1251_bulgarian_ci" but it still save bulgarian text "?? ?? ?". What I have to do to save the text into my database?
Reply
#2

Any ideas?
Reply
#3

I tried to use this code:
PHP код:
mysql_set_charset("cp1251_bulgarian_ci");
    
mysql_tquery(MyMySQL"SET NAMES `cp1251`""""");
    
mysql_tquery(MyMySQL"SET CHARACTER SET `cp1251`","""");
    
mysql_tquery(MyMySQL"SET COLLATION_CONNECTION = `cp1251_bulgarian_ci`"""""); 
as in this topic the guy said!
BUT IT STILL DOESN'T WORK!
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
Don't use code pages, just stick to Unicode. However note that MySQL may have a strange non-standard Unicode version by default, you need "utf8mb4_unicode_ci" to get real Unicode in that case.
I changed that:
PHP код:
mysql_set_charset("utf8mb4_unicode_ci"); 
and I changed the collection in MySQL to "utf8mb4_unicode_ci" and now I have different output. It's something like this: "Íå ñëóøà"
Reply
#5

please help me guys
Reply
#6

There is it my MySQL insert into the database code:
PHP код:
mysql_format(MyMySQLquerysizeof(query), "INSERT INTO `reports` (`DateTime`, `Sender`, `Receiver`, `Reason`) VALUES('%s', '%s', '%s', '%s')"tFormatPlayerName(playerid), PlayerName(ID), REASON);
                
mysql_query(MyMySQLquery); 
It is in my Gamemode:
PHP код:
mysql_set_charset("utf8mb4_unicode_c"); 
My structure:
https://imgur.com/a/ScZrYwI
My input as reason: "здравей"
and my output:
https://imgur.com/a/U0IB5jJ
Reply
#7

anybody?
Reply
#8

Please guys I really need help! +1 REP if you help me!!!!!
Reply
#9

Quote:
Originally Posted by ******
Посмотреть сообщение
That really looks like you are mixing up code pages, like you are saving non-unicode text as unicode.
Please, help me. No one else can help me
Reply
#10

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
That really looks like you are mixing up code pages, like you are saving non-unicode text as unicode.
The data you are writing isn’t unicode, while the column is. You need to figure out what the data is and convert it.
Reply
#11

Quote:
Originally Posted by ******
Посмотреть сообщение
The data you are writing isn’t unicode, while the column is. You need to figure out what the data is and convert it.
Where can I find it?
I read in the MySQL forums and people says that if I set the charset to "utf8" it will work, but it doesn't! What I have to do?
Reply
#12

I think your problem is, that you've already created the table with the wrong charset.

Can you look in PHPMyAdmin for example, what charset your column have?

Or change it directly to "utf8mb4_unicode_ci"
Reply
#13

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
I think your problem is, that you've already created the table with the wrong charset.

Can you look in PHPMyAdmin for example, what charset your column have?

Or change it directly to "utf8mb4_unicode_ci"
Take a look at it dude:
https://imgur.com/a/jLkOhlr
Reply
#14

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
Where can I find it? I read in the MySQL forums and people says that if I set the charset to “utf8” it will work, but it doesn’t! What I have to do?
Yes, as a general rule you should always use UTF-8. However, the problem is that while MySQL is set to unicode (which is good), the game isn’t. Thus you are mixing codepages, which requires conversion.
Reply
#15

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
Yes, as a general rule you should always use UTF-8. However, the problem is that while MySQL is set to unicode (which is good), the game isn’t. Thus you are mixing codepages, which requires conversion.
How and where can I convert it?
Reply
#16

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
I think your problem is, that you've already created the table with the wrong charset.

Can you look in PHPMyAdmin for example, what charset your column have?

Or change it directly to "utf8mb4_unicode_ci"
I recreated the table with "utf8mb64_unicode_ci" and it's still working!
Reply
#17

Any idea Y_Less?
Reply
#18

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
Any idea Y_Less?
Relax, dude. You'll eventually get a response from somebody who's able to help.
Reply
#19

Quote:
Originally Posted by Infin1ty
Посмотреть сообщение
Relax, dude. You'll eventually get a response from somebody who's able to help.
Third day dude... What can I do?
Reply
#20

anybody?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)