Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8029429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:26:07+00:00 2026-06-05T00:26:07+00:00

I have a WinForms application which should be able to save (to db) and

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:26:08+00:00Added an answer on June 5, 2026 at 12:26 am

    This answer says The collation is only used for sorting and comparison, not for saving data.

    I tried this which worked beautifully.

    conString = "SERVER=localhost;DATABASE=hi;UID=root;PASSWORD=;Min Pool Size=0;Max Pool Size=200;charset=utf8;";
    

    Edit: Let me make it complete.

    .NET Connector manual says "CharSet specifies the character set that should be used to encode all queries SENT TO THE SERVER. Resultsets are still returned in the character set of the result data."

    Which means:

    1, Setting charset=utf8 is required only when saving the data to database, and not when retrieving since .NET connector gets retrieves it in the format its saved. I am not saying when reading data the connectionstring has to be modified to remove charset=utf8,no. It works both ways. Just making it clear that only saving explicitly requires charset=utf8.

    2, Its not even paramount that your db has its default charset set to utf8. Even latin1 one would do if you have charset defined in connectionstring as utf8

    I tested the above cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WinForms application in which my background worker is doing a sync
I have a WinForms application with a user control in which I change the
I have a WinForms application that requires some configuration which I do at install
I have a console application which can also open winform under certain conditions.Processing(its a
I have a Winforms application that generates its own PrintDocument object for printing. It
Ok, I have developed this WinForms client, which interacts with a server (ASPX Application)
We've got a winforms LOB application, which under normal circumstances should be started from
I have a winforms application in which some of the data is stored in
I have a list box on my WinForms application which populates with the following
I have a working WinForms application, written in c#, which is divided in several

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.