How to output latvian symbols?

Error Message

I want to get latvian words from my database on index page, but it returns “?” or something like that when i want to fetch it. What do I do?

Maybe these?

Also do this:

/* Connect to a MySQL database using driver invocation */
$dsn = 'mysql:dbname=testdb;host=';
$user = 'dbuser';
$password = 'dbpass';

$dbh = new PDO($dsn, $user, $password);


I were trying to do like this, but get an error

The host name is a URL found in the client area.

And what is the error you are getting?

Also, how does connecting to a database have to do with Latvion characters, I am a bit confused.


Oh, I’m sorry that i didn’t include that, after dbname i’m writing ;charset=utf8mb4 as said in guide from here: PHP: PDO_MYSQL DSN - Manual

$dsn = 'mysql:dbname=...;charset=utf8mb4;host=...';
    $user = 'epiz_33247847';
    $password = 'RENOVEDBYMOD';

    $conn = new PDO($dsn, $user, $password);

    if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());

I believe these are the errors


Check this out


This code helped me to set charset i need
$conn = new mysqli(‘localhost’, ‘root’, ‘’, ‘re-books’);

/* Set the desired charset after establishing a connection */

//printf("Success... %s\n", $conn->host_info);


1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.