I was asked a dozen times, but I only want to insert a German letter of type "ร" into the database using php script, which simply does not work using existing solutions.
<?php header('Content-type: text/html; charset=utf-8'); $con = mysqli_connect("localhost", "username", "password"); mysqli_set_charset($con, "utf8mb4"); mysqli_select_db($con, "database"); mysqli_query($con, "SET SESSION CHARACTER_SET_RESULTS =utf8mb4;"); mysqli_query($con, "SET SESSION CHARACTER_SET_CLIENT =utf8mb4;"); mysqli_query($con, "SET NAMES 'utf8mb4';"); mysqli_query($con, "SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8';"); $title = 'ร'; $result = mysqli_query($con, "INSERT INTO Test (Title) VALUES ('" . utf8_encode($title) . "');");
The wrapper for the Header column is utf8mb4_general_ci, and the table itself is utf8_general_ci. MySQL server version is 5.5.31 MySQL Charset UTF-8 Unicode
Does anyone know what I'm doing wrong, or am I missing something here?
source share