Grid/Connector special characters


I’m using a grid with an connector which loads data from a mysql-DB.
It worked fine until I decided to change my webhoster. Now I can’t get the special German characters from the DB in my grid.

This is the connector-code from my first hoster (it works fine and displays all chars like ‘ä’):

<?php echo "<?xml version='1.0' encoding='ISO-8859-1' ?>";
    $db = mysql_connect("<some login data...>");
    mysql_select_db("<a db name>");

function change_stimme($row){
       $stimme = $row->get_value("Stimme");
       switch ($stimme) {
       case 1:
       case 2:
       case 3:
       case 4:

$mg = $_GET["mg"];

$sqlstr = "SELECT ";
$sqlstr.= "* ";
$sqlstr.= "FROM ";
$sqlstr.= "tblChorMitglied ";
if ($mg == 0 or $mg == 1) 
	$sqlstr.= "WHERE ";	
	$sqlstr.= "Aktiv ";	
	$sqlstr.= "= ";	
	$sqlstr.= $mg;
$sqlstr.= ";";

$grid = new GridConnector($db,"MySQL");
$grid->render_sql($sqlstr,"Mitglied_ID", "Mitglied_ID,Name, Vorname, Geburtsdatum, Stimme");


After moving to another hoster this connector doesn’t work any more because the first line echo “<?xml version='1.0' encoding='ISO-8859-1' ?>”; is before the require-line

-> Warning: Cannot modify header information - headers already sent by…

If I do first the “require-step” and then the “echo”, it doesn’t work on both servers.

Now I tried the following solution, but it doen’t work either:

... $grid = new GridConnector($db,"MySQL"); ----> $grid->set_encoding("iso-8859-1"); $grid->event->attach("beforeRender","change_stimme"); $grid->render_sql($sqlstr,"Mitglied_ID", "Mitglied_ID,Name, Vorname, Geburtsdatum, Stimme");

Where’s the point I don’t get? How can I add the right encoding information to the XML?
The characters don’t appear in the grid, but not in the XML-Output of the .php either, so it’s not a grid problem, I guess.


Sorry for disturbing you, I found the solution myself with ob_start()/ob_flush()…

To be sure that no extra output breaks xml generation you can place connector’s include as first line of php file, in such case it will work with any buffering settings.

require("../dhtmlx/dhtmlxConnector/codebase/grid_connector.php"); //first line!
echo "<?xml version='1.0' encoding='ISO-8859-1' ?>";

Could you tell me please how did you solve the problem exactly??