Jump to content
Sign in to follow this  
Portekoi

Encodage

Recommended Posts

Bonjour,

Je travaille actuellement sur un site basé sur "Osdate". Un petit CMS de rencontre.

Dessus, figure une messagerie instantané mais lorsque l'on saisie un accent, voici se qui apparait :

éééÚÚéÚéÚ lorsque l'on saisie des ééééé ...

Voici le code en question :


function sendMsg() {
var msg1 = document.getElementById('im_msg').value;
if (msg1.length > im_msg_length) {
alert(im_msg_long); return false;
}
var msg=encodeURIComponent(msg1.replace(/&/g, "|amp|"));
imhttp.open('POST',"im_prog.php",false);
imhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
imhttp.send("a=sendMsg&refuid="+im_refuid+"&msg="+msg);
IMhandleResponse1();
cleared=false;
}

Et le fichier php derriere :


header('Content-Type: text/xml');

echo('<?xml version="1.0" standalone="yes" encoding="'.get_lang('ENCODING').'"?>');

if (!isset($_REQUEST['a']) || empty($_REQUEST['a']) ) return '';

function is_in_mylist($username) {
global $db;
$bdy = $db->getAll('select act from ! where username = ? and ref_username = ? ', array(BUDDY_BAN_TABLE, $_SESSION['UserName'], $username ) );
return $bdy;
}

/* First update the online users table for this user being online */

$ping_time = time();

$db->query("update ! set is_online=1, last_ping=? WHERE userid=?", array(ONLINE_USERS_TABLE, $ping_time, $_SESSION['UserId'] ) );

$msg_sent = '';

switch (trim($_REQUEST['a'])) {

case 'sendMsg':

Suivi de la requête d'insertion...

Question : Comment faire pour qu'il insert correctement les accents dans la base?

Portekoi

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...