sto cercando di creami un form ma il mio problema è che se inserisco caratteri tipo 国 che in phpmyadmin viene visualizzato in 国 lui mi inserisce questo å½ senza in questo caso >
il db che ho creato
mentre la pagina del form che utilizza jquery e questacodice:CREATE TABLE IF NOT EXISTS `country` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
mentre la pagina risposta.phpcodice:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <title>Untitled Document</title> </head> <script> $(document).ready(function() { $('#checkbox').click(function() { var name ="name=A"+ encodeURIComponent($("#name").val()); $.ajax({type : "POST", url : "risposta.php", data : name, success : function(data) { alert(data); } }); }); }); </script> <form action="" method=""> <input name="" id="name"; type="text" value=""/> <input type = "checkbox" name = "checkbox" id = "checkbox"> </form> </body> </html>
ho provato anche altre funzioni tipocodice:$query='INSERT INTO `country` (`name`) VALUES ("'.($_POST['name']).'");'; mysql_query($query);
mysql_real_escape_string
utf8_encode
stripslashes
mysqli_client_encoding
ma senza successo e inoltre utilizzando ad esempio mysqlajaxtableeditor (editor ajax per mysql) sulla stessa tabella non si verificano questi problemi ...
dove potrebbe essere l'errore ?
Grazie ancora

Rispondi quotando