[TYPO3-german] Bodytext aus Tabelle tt_content wird nicht angezeigt

Norbert Egger egger at xne.at
Fri Nov 21 22:53:56 CET 2014


Danke für die Tips. Es war ein UTF-8 Problem. Die tt_content war latin1 kodiert. Ich hab nun dies auf utf8_gerneral_ci umgestellt und die Inhalte von bodytext mit diesem kleinen PHP Skript im MySQL von latin1 auf UTF-8 konvertiert.

THX & LG Norbert


<?php

$servername = "localhost";
$username = "";
$password = "";
$dbname = "";

echo "Starte tt_con_conv... <br>";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
$sql = "SELECT uid,bodytext FROM tt_content WHERE bodytext IS NOT NULL;";

$result = $conn->query($sql);
$zeilen = $result->num_rows;
if ($result->num_rows > 0) {
	echo "work";
    // output data of each row
    while($row = $result->fetch_assoc()) {
		
		//echo $row["bodytext"];
        //convert each row
		$bodytextAsUtf8= utf8_encode($row["bodytext"]);
		//update column
		$updateSql = sprintf("UPDATE tt_content SET bodytext = '" . $bodytextAsUtf8 ."' WHERE uid = " . $row["uid"] . ";"); 
		$res = $conn->query($updateSql);
		
    }
} else {
    echo "0 results";
}
echo $zeilen . " Zeilen aktualisiert.";
$conn->close();
?>




More information about the TYPO3-german mailing list