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

  • SEARCH
  • Home
  • 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 7041187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:00:31+00:00 2026-05-28T02:00:31+00:00

I have read many articles, discussions and tutorials about using utf-8 charset in mysql.

  • 0

I have read many articles, discussions and tutorials about using utf-8 charset in mysql. Several approaches are introduced apparently for different cases (e.g. transfering to utf-8). What are the required appraoches for creating and using utf-8 mysql databases? The methods I am aware of:

  1. Using CHARACTER SET utf8 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT COLLATE utf8_general_ci when creating the databases.
  2. Using DEFAULT CHARSET=utf8 COLLATE utf8_general_ci when creating table.
  3. Using mysql_set_charset('utf8',$con); after every mysql connection.
  4. Setting default mysql connection in my.conf as default-character-set = utf8, collation-server = utf8_unicode_ci, init-connect='SET NAMES utf8', character-set-server = utf8

Are all of these actions needed to operate mysql database with utf-8 charset? If not, which is the best way(s)?

  • 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-05-28T02:00:32+00:00Added an answer on May 28, 2026 at 2:00 am

    When you specify a character encoding like utf8 for a column it means that MySQL will use that encoding to store text. When you specify a default character encoding for a database or a table it means that their columns will have that encoding, unless you say otherwise. This affects the number of bytes the data will occupy on disk: in latin1 it’s 1 byte per character, in sjis 2 bytes, in utf8 it varies. If you are storing a lot of text in Japanese you may want to use sjis instead of utf8.

    When you specify a collation like utf8_general_ci for a column it means that MySQL will sort the data differently in ORDER BY or indices. Cultures have different rules of sorting text: for example in Swedish Ä is the second to last letter of the alphabet, while in English it’s equivalent to A. So with Swedish collation you get a < b < ä and with English collation you get a = ä < b. Which collation you should use depends mostly on what your users expect to see.

    And yet what the MySQL server does doesn’t affect how the MySQL client returns the text: every connection has its own client encoding. The client converts the results to the connection encoding automatically so you don’t really have to care about what the server does. In fact you can make a select with columns in different encodings and the MySQL client correctly converts everything to utf8 or whatever.

    So what you really need to worry about is setting the connection encoding, which is what your #3 does. Probably SET NAMES in #4 also works but I wouldn’t rely on it.

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

Sidebar

Related Questions

I have read a couple of articles about the using statement to try and
I have read so many articles about integration and yet i did not found
I have read many about REST api in php articles. but I still get
I have read many articles about vertical centering but I’m afraid not many of
I have read many articles about XML parsing in Android. However, all of them
In many articles, tutorials, docs, have read so far, that we call startService() or
I have read many articles about linq to sql performance. The result which i
I am beginning to write a Facebook application. I have read many articles about
I have just read many, many articles on SO about hashing passwords with salt
I have read many MSDN articles about assembly signing and I haven't found nothing

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.