Managing UTF8 encoding items in my database

Hi guys

I am a bit lost in translation with some unicodes characters I have to manage in my WordPress project. Here is the scene. I am working on a msuci and artists database. My source dataset is a CSV file, where all characters are UTF8 encoded. Here is the name of a finnish artist (Kaarija):


I am the importing this CSV dataset into a Mysql table “artists\_table” (field : performer VARCHAR(255) CHARACTER SET utf8 NOT NULL). Here is how each record is processed:

`foreach ($row_data as $key => $value) {`

`$row_data[$key] = mb_convert_encoding($value, ‘UTF-8’, ‘auto’);`


`// check the record doesn’t already exists`

`$wpdb->insert(‘artists_table’, $row_data);`

The record is then stored like this, in the database:

Now comes the tricky part where I am lost. I have a function that creates (automatically) posts for each artist from the database and has to compare post titles with items in the database as part of the business logic. Post title is the one recorded in the DB, see an extract from the posts table:

Should I work with UTF8\_decode when displaying data to the user, or should I manage it at the source and have the right decoded names in the “artists\_table” (then, how ?)

Many thanke for your feedback !


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer