jQWidgets Forums

jQuery UI Widgets Forums Grid encoding utf8 grid problem

This topic contains 4 replies, has 2 voices, and was last updated by  f4b10 12 years, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • encoding utf8 grid problem #8079

    f4b10
    Member

    Hi to everyone!

    i have a problem with encoding of data. I’ve created a grid like this

      var url = "requestpage.php?q=getLocaliFromCity&e="+ $(this).attr('value');
    
                // prepare the data
                var source =
                {
                    datatype: "json",
                    datafields: [
                        { name: 'name' },
                        { name: 'creatoda' }
                    ],
                    id: 'id',
                    url: url,
     				root: 'data'
                };
                var dataAdapter = new $.jqx.dataAdapter(source);
    
                $("#grid").jqxGrid({
                    width: 670,
                    source: dataAdapter,
    
                    columnsresize: true,
                    columns: [
                      { text: 'Nome', dataField: 'nome', width: 100, cellsalign: 'right' },
                      { text: 'Creato Da', dataField: 'creatoda', width: 100 }
    
                    ]
                });

    This call a functions in server page .php that return json data, but they are not converted to utf8 correctly

    {"data":[{"nome":"Mu Caf\u00e8","creatoda":"Pallo"},{"nome":"Tofi\u00e0","creatoda":"Pallo"}]}

    i don’t know why!

    i’m expect this!

    {"data":[{"nome":"Mu Cafè","creatoda":"Pallo"},{"nome":"Tofià","creatoda":"Pallo"}]}

    My html page is encoded with utf-8 also the mysql tables and the php connection.

    Any solutions?

    Thanks!

    encoding utf8 grid problem #8084

    Peter Stoev
    Keymaster

    Hi f4b10,

    For integration with PHP, see this help topic: bind-jquery-grid-to-mysql-database-using-php.htm.

    For changing the encoding, you need to set the jqxDataAdapter’s contentType setting. For more information, read here: jquery-data-adapter.htm. You would also have to specify the charset on the server.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    encoding utf8 grid problem #8087

    f4b10
    Member

    it’s not the solution…

    i’ve already read the documentation. It’s return

    {"data":[{"nome":"Mu Caf\u00e8","creatoda":"Pallo"},{"nome":"Tofi\u00e0","creatoda":"Pallo"}]}

    The charset on my server is the default. i have put it inside the connection.php file


    $db->query("Set character_set_connection=utf8");
    $db->query("Set character_set_results=utf8");
    $db->query("Set character_set_client=utf8");
    /code>

    encoding utf8 grid problem #8088

    Peter Stoev
    Keymaster

    Hi f4b10,

    What about the contentType: contentType: “application/json; charset=utf-8”. Have you tried it?
    Did you set the PHP header on your server to: header(‘Content-Type: text/html; charset=utf-8’);?

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    encoding utf8 grid problem #8197

    f4b10
    Member

    Solved!

    i’ve mistake the names of columns from “nome” to “name”

    i’m sorry to everyone! its work correctly! All settings are right!

    Thanks Peter!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.