I have a WinForms application which should be able to save (to db) and later display non latin characters. I know its something related to charset. My database, and all the tables have their default charset set to utf8. But this still doesn't save the non latin characters preserving their weirdness :).
After some googling and SO-ing I got to know it is something about SET NAMES 'utf8'
. But where do I apply this? A lot of similar threads on SO deals with php and they say one have to include SET NAMES 'utf8'
at the start of the query. But in my code there are hundreds of queries and tinkering each place is a mess.
If I need to configure MySQL for that, then can it be done programmatically? I hope there is some solution by setting this in connection string.
I tried this:
conString = "SERVER=localhost;DATABASE=hi;UID=root;PASSWORD=;Min Pool Size=0;Max Pool Size=200;SET NAMES 'utf8'";
which gives run time error saying connection string is incorrect format.