Question

I'm trying to execute these commands:

$sql = "UPDATE `ps_product_lang` SET `available_now` = 'Skladem do 10 pracovních dnů';";
$sql = mb_convert_encoding($sql, "UTF-8");
$databaze = new mysqli(_DB_SERVER_,_DB_USER_,_DB_PASSWD_,_DB_NAME_);

    if (mysqli_connect_errno()) {
        blah blah ...
}
if ($databaze->query($sql) === TRUE) {
    blah blah ...
}
$databaze->close();

After executing this code the SQL DB has in it Skladem do 10 pracovních dnù instead of Skladem do 10 pracovních dnů .. se the difference? ù instead of ů .. we don't even have that weird char ù in our alphabet.

Was it helpful?

Solution

Ok, I've after really long time trying many options found the solution:

instead of writing this:

$sql = mb_convert_encoding($sql, "UTF-8");

there should be written this:

$sql = mb_convert_encoding($sql, "UTF-8", "ISO-8859-2");

while you should make sure your text is written in this format ISO-8859-2 f.e. in your head tag by having this in there: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"/>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top