jQWidgets Forums
jQuery UI Widgets › Forums › General Discussions › Mysql charset problem Latin2
This topic contains 7 replies, has 2 voices, and was last updated by szoron 11 years, 2 months ago.
-
Author
-
Hello!
I use Mysql latin2 database.
I testing combobox, but if displayMember field contains latin2 char, dont display string.What could be the solution?
THX
Hi szoron,
If you experience some kind of issue, then please share a sample using http://jsfiddle.net/ so we can test it, too and also if your issue is about jqxComboBox, post your question in the specific Forum.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comfunctions work
but accented lines are not loadedexample: Fót, Sződ, Göd, Dózsa György u. (this is hungarian city and streets)
this is your demo: cascading ComboBox
Adapted from his own mysql database<!DOCTYPE html> <html lang="hu"> <head> <title id='Description'>In this example is demonstrated how to create cascading ComboBox. The data source of the "Orders" Combobox is updated dynamically depending on the selected Customer.</title> <link rel="stylesheet" href="jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="scripts/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="jqwidgets/jqxlistbox.js"></script> <script type="text/javascript" src="jqwidgets/jqxcombobox.js"></script> <script type="text/javascript" src="scripts/demos.js"></script> <script type="text/javascript"> $(document).ready(function () { // prepare the data var customersSource = { datatype: "json", datafields: [ { name: 'city'}, { name: 'i'} ], url: 'cascadingcombobox_data.php', cache: false, async: false }; var customersAdapter = new $.jqx.dataAdapter(customersSource); $("#customers").jqxComboBox( { source: customersAdapter, width: 200, height: 25, promptText: "Select customer...", displayMember: 'city', valueMember: 'i' }); var ordersSource = { datatype: "json", datafields: [ { name: 'i'}, { name: 'address'}, { name: 'city'}, { name: 'id'} ], url: 'cascadingcombobox_data.php', cache: false, async: false }; var ordersAdapter = new $.jqx.dataAdapter(ordersSource); $("#orders").jqxComboBox( { width: 200, height: 25, disabled: true, promptText: "Select order...", displayMember: 'address', valueMember: 'i', autoDropDownHeight: true }); $("#customers").bind('select', function(event) { if (event.args) { $("#orders").jqxComboBox({ disabled: false, selectedIndex: -1}); var value = event.args.item.value; ordersSource.data = {i: value}; ordersAdapter = new $.jqx.dataAdapter(ordersSource); $("#orders").jqxComboBox({source: ordersAdapter}); } }); $("#orders").bind('select', function(event) { if (event.args) { var index = $("#orders").jqxComboBox('selectedIndex'); if (index != -1) { var record = ordersAdapter.records[index]; var details = "<table><tr><td>OrderDate</td><td>ShipCity</td><td>ShipCountry</td><td>ShipAddress</td><td>ShipName</td></tr>"; details += "<tr><td>" + record.OrderDate + "</td><td>" + record.ShipCity + "</td><td>" + record.ShipCountry + "</td><td>" + record.ShipAddress + "</td><td>" + record.ShipName + "</td></tr>"; $("#orderInfo").html(details); } } }); }); </script> </head> <body class='default'> <div> <span style="margin-top: 6px; font-size: 12px; font-family: verdana; float: left;">Customers:</span><div style="margin-left: 5px; float: left;" id="customers"></div> <div style='clear: both;'></div> <div style='margin-top: 20px;'> <span style="margin-top: 6px; font-size: 12px; font-family: verdana; float: left;">Orders:</span><div style="margin-left: 5px; float: left;" id="orders"></div> <br /> <div style="margin-top: 25px; font-size: 12px; font-family: verdana;" id="orderInfo"></div> </div> </div> </body> </html>
and this is your cascadingcombobox_data.php
Adapted from his own mysql database<?php #Include the connect.php file include('connect.php'); #Connect to the database //connection String $connect = mysql_connect($hostname, $username, $password) or die('Could not connect: ' . mysql_error()); //select database mysql_select_db($database, $connect); //Select The database $bool = mysql_select_db($database, $connect); if ($bool === False){ print "can't find $database"; } if (isset($_GET['i'])) { // get data and store in a json array $query = "SELECT * FROM projekts where i='" .$_GET['i'] . "'"; $result = mysql_query($query) or die("SQL Error 1: " . mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $orders[] = array( 'city' => $row['city'], 'i' => $row['i'], 'address' => $row['address'], 'id' => $row['id'] ); } echo json_encode($orders); return; } // get data and store in a json array $query = "SELECT * FROM projekts where address <> '' and imp_num <> ''"; $result = mysql_query($query) or die("SQL Error 1: " . mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $customers[] = array( 'i' => $row['i'], 'city' => $row['city'] ); } echo json_encode($customers); ?>
Hi szoron,
There’s no problem to display such Texts in our widget. It depends what your server returns as a result.
<!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> <script type="text/javascript" src="../../scripts/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="../../scripts/demos.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script> <script type="text/javascript" src="../../jqwidgets/jqxcombobox.js"></script> <script type="text/javascript"> $(document).ready(function () { var source = [ "Fót", "Sződ", "Göd", "Dózsa", "György" ]; // Create a jqxComboBox $("#jqxComboBox").jqxComboBox({ source: source, width: '200px', height: '25px' }); }); </script> </head> <body> <div style='float: left; margin-top: 10px;' id='jqxComboBox'> </div> </body> </html>
If necessary, you can also experiment with the source object’s contentType property. Also this post could be helpful for your scenario: http://stackoverflow.com/questions/10077451/hungarian-characters-gone-when-loading-from-database?rq=1
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThe query is good, but the place where the accent is empty.
it’s like, leave it blank line where the accented characters has been foundHi szoron,
I don’t think so. The query most probably removed the Invalid strings. Please, follow my suggestions and also try the sample which I posted to verify that it is not a ComboBox problem and is a client-server, server-client communication result. That’s why I posted you a link to a solution in stackoverflow.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThe relationship between the client-server flawless.
List all through Delphi.
If another character set is put out incorrect character.
This component, however, omit the words from the list that do not contain értelmezhező character.the solution
-
AuthorPosts
You must be logged in to reply to this topic.