Cyrillic charset problems

I want to make table from mysql with Grid. Mysql table I need is cp1251_general_ci.

I took code from tutorial like:

<!DOCTYPE html>
<meta content="text/html; charset=windows-1251" http-equiv="Content-Type" />
...
var contactsGrid = layout.cells("a").attachGrid();
contactsGrid.setHeader("Phone, Name, Address") // (written in Cyrillic)
...
contactsGrid.init();
contactsGrid.load("data/contacts.php"); 

contacts.php

<?php
require("../codebase/connector/grid_connector.php");//adds the connector engine
$res=mysql_connect("localhost","root","");//connects to server with  db
//mysql_select_db("dhtmlx_tutorial");//connects to db with name "dhtmlx_tutorial"  
mysql_select_db("mybase");
mysql_query("SET CHARACTER SET 'cp1251'",$res);  
$conn = new GridConnector($res);    
$conn->render_table("mytable"......);

It outputs Cyrillic names of colums correctly, but there ??? in cells. When I try to make same table via simple PHP

<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mybase",$db);
mysql_query ("SET CHARACTER SET 'cp1251'", $db); 
$result=mysql_query ("SELECT ...
....

all is OK, though without mysql_query (“SET CHARACTER SET ‘cp1251’”, $db); I also got ???.

How can I output Cyrrilic correctly ?

Please, try to define the encoding in your connector:
docs.dhtmlx.com/connector__php__ … etencoding

Thanks, I’ve also fount it, but it didn’t help.

$conn = new GridConnector($res);            
$conn->set_encoding("windows-1251");

May be I use set_encoding incorrectly or there is some other way ?

Which encoding you are using for the HTML page?
Can you save and share the XML output from the problematic script? ( please attach it as a file to preserve the encoding )

In the index.html I user Windows-1251

[code]

...[/code]

As I said, column headers in Cyrillic are displayed correctly

contactsGrid.setHeader("Телефон, Имя, Адрес") // (written in Cyrillic)

How can I save xml output ?

Here is text of index.html, connector contacts_cyr.php and sql table

pastebin.com/DXDbKrum

Please, try to add the following line in your php file:
mysql_query(“SET NAMES cp1251”);

$res=mysql_connect("localhost","root","");//connects to server with db mysql_select_db("test"); mysql_query("SET NAMES cp1251"); $conn = new GridConnector($res); //initializes the connector object $conn->set_encoding("windows-1251"); $conn->render_table("cyr","tel","name, adr, tel"); //loads data ?>

Use UTF encoding everywhere in source code as default.
For correct encoding data from database use method

$conn->set_encoding("windows-1251");

I had likewise case and all works fine.