php - Character encoding issues - UTF-8 / Issue while transmitting data on the internet? -


i've got data being sent client side sending this:

// $booktitle = "comí habitación bailé"  $xml_obj = new domdocument('1.0', 'utf-8');  // node created booktitle , added xml_obj  // no htmlentities / other transformations done  $returnheader = drupal_http_request($url, $headers = array("content-type:  text/xml; charset=utf-8"), $method = 'post', $data = $xml_data, $retry = 3); 

when receive @ end (via drupal_http_request) , htmlentities on it, following:

 comã­ habitaciã³n bailã© 

which when displayed looks gibberish:

 comí habitación bailé 

what going wrong?


edit 1)

<?php $title = "comí habitación bailé"; echo "title=$title\n"; echo 'encoding '.mb_detect_encoding($title); $heutf8 = htmlentities($title, ent_compat, "utf-8"); echo "heutf8=$heutf8\n"; ?> 

running test script on windows machine , redirecting file shows:

title=comí habitación bailé encoding utf-8heutf8= 

running on linux system:

title=comí habitación bailé encoding utf-8php warning:  htmlentities(): invalid multibyte sequence in argument in /home/testaccount/public_html/test2.php on line 5 heutf8= 

htmlentities interprets input iso-8859-1 default; passing utf-8 charset parameter?


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -