Title: encoding problem
Last modified: August 30, 2016

---

# encoding problem

 *  [mahmuzar](https://wordpress.org/support/users/mahmuzar/)
 * (@mahmuzar)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/encoding-problem-20/)
 * Hi guys.
 * There are problems with the encoding.
    Trying to create a plug-in to the admin
   panel to it. The problem is that when you add data through a plug-in MySql appear“???????????”.
 * Encoding Server have
 *     ```
       AddDefaultCharset utf-8
       ```
   
 * Edncoding DB server
 *     ```
       UTF-8 Unicode (utf8)
       ```
   
 * encoding table:
 *     ```
       InnoDB	latin1_swedish_ci
       ```
   
 * encoding other tables:
 *     ```
       InnoDB	utf8_general_ci
       InnoDB	utf8mb4_unicode_ci
       ```
   
 * To specify the encoding when you create a database table?
 * this creates a table:
 *     ```
       function create_table() {
           global $wpdb;
   
           $table_name = $wpdb->prefix . "services";
           if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
               $sql = "CREATE TABLE " . $table_name . " (
       	  id mediumint(9) NOT NULL AUTO_INCREMENT,
       	  time bigint(11) DEFAULT '0' NOT NULL,
       	  name tinytext NOT NULL,
       	  text text NOT NULL,
       	  url VARCHAR(55) NOT NULL,
       	  UNIQUE KEY id (id)
       	);";
   
               require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
               dbDelta($sql);
           }
       }
       ```
   
 * this insert to table:
 *     ```
       function insert_services() {
           if (isset($_POST['add_service'])) {
               global $wpdb;
               var_dump($_POST);
               $table_name = $wpdb->prefix . "services";
               $services_name = $_POST['service_name'];
               $services_text = $_POST['service_text'];
               $rows_affected = $wpdb->insert($table_name, array('time' => current_time('mysql'), 'name' => $services_name, 'text' => $services_text));
           }
       }
       ```
   
 * **sorry for my English**

The topic ‘encoding problem’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [encoding](https://wordpress.org/support/topic-tag/encoding/)
 * [page](https://wordpress.org/support/topic-tag/page/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [mahmuzar](https://wordpress.org/support/users/mahmuzar/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/encoding-problem-20/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
