I'm specifically talking about the å, ä and ö in the swedish language. When displayed in paragraphs I use a function to substitute the letters to their HTML entities.
That works fine but now I want to have a function that let's the page admins to change the page title. I want the current title to be preloaded into the inputbox. It's not so easy to read when every ö is translated to it's html entity.
From other answers I'v checked that the files are saved as UTF-8 without BOM in Notepad++.
Database connection are written as:
$conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName); if ($conn->connect_error) { trigger_error('Database connection failed: ' . $conn->connect_error, E_USER_ERROR); }
$conn->set_charset("utf-8");
In the header of the html document I have:
<meta http-equiv="content-type" content="text/html" charset="utf-8" />
Database was created as "latin1_swedish_ci" and in phpmyadmin it displays alright. The database call looks like this. The site works as it should when there is no å, ä and ö. But when there is the input box empty.
include 'db.inc.php';
$sql = "SELECT site_admin_title FROM site_admin WHERE site_admin_id = ?"; $id = 1;
$loadData = $conn->prepare($sql); if($loadData === false) { trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR); }
$loadData->bind_param('i',$id);
$loadData->execute();
$loadData->bind_result($site_admin_title);
$loadData->fetch();
$output_string = $ljusimorker_site_admin_title;
$loadData->close();
$conn->close();
echo json_encode($output_string);
Any ideas?