Hello friends, just today I got a requirement of adding Hindi support to the MySQL database which was till now completely in English. Well, i had worked on many Hindi data before too but this time is the first time I was the getting error while adding the Hindi text. I tried to add the Hindi text via Android and retrofit but in the database in place of Hindi text only ?????? were added and ya I laughed for a movement on that.
So I had to add Hindi text in the database so that it can be added, retrieved and also displayed in Android. I looked around the internet and there were like many many methods of achieving same. But I wanted something that is simplest, easiest and fastest for my work. The expected outcome for me was something like this:
Various methods provided online included some changes to the table. Some had some client side code some changed the text encoding and a lot more! Apart from all this, the changes in the database was also an option.
The one I selected was simple. Just run the following SQL command:-
ALTER TABLE <tablename> CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
Just add your table name in its proper place run and bam you are ready to go now your database (specifically this table) supports Hindi data u can test it upload more text and retrieve it all working perfectly fine!!
So that's all for now, u can surely add your own methods of doing same in comments!
Thankyou
No comments :
Post a Comment