title: PHP: xml-rpc and Turkish characters
body: <p>I am trying to post to my wordpress site by xml-rpc.</p>
  
  <p>I have two problem about the turkish charcters.</p>
  
  <p>1 - When i use one of theese characters <strong>(Çç,Ğğ,Iı,Öö,Şş,Üü)</strong> in the title sends a post to wordpress without title.?</p>
  
  <p>2 - And when i use form same charcters in body content it sends in different form.</p>
  
  <p>For example in body content i have "<strong>Ankaralıyım</strong>" an dit goes to wordpress as "<strong>Ankaralýyým</strong>".</p>
  
  <p>Here is the code I use</p>
  
  <pre><code> &lt;?php
  $title="Karaçay";
  $body="Ankaralıyım";
  
  $rpcurl="http://localhost/wp/xmlrpc.php";
  $username="admin";
  $password="pass";
  $categories="try";
  
  echo wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$categories,'');
  
  function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$category,$keywords='',$encoding='UTF-8') 
  {
      $title = htmlentities($title,ENT_NOQUOTES,$encoding);
      $keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);
  
      $content = array(
          'title'=&gt;$title,
          'description'=&gt;$body,
          'mt_allow_comments'=&gt;0,  // 1 to allow comments
          'mt_allow_pings'=&gt;0,  // 1 to allow trackbacks
          'post_type'=&gt;'post',
          'mt_keywords'=&gt;$keywords,
          'categories'=&gt;array($category)
      );
      $params = array(0,$username,$password,$content,true);
      $request = xmlrpc_encode_request('metaWeblog.newPost',$params, array('encoding'=&gt;'UTF-8'));
      $ch = curl_init();
  
      curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
      curl_setopt($ch, CURLOPT_URL, $rpcurl);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_TIMEOUT, 1);
      $results = curl_exec($ch);
      curl_close($ch);
      return $results;
  }
  
  ?&gt;
  </code></pre>
  
  <p>I do not have any language problem when i add the post from wordpress.</p>
  
  <p>How i will fix this?</p>
  
  <p>And i have tried the same thing with different code and this time if there was any turkish character in the title or post I got this result
  <strong><em>Error while creating a new post-32700 : parse error. not well formed</em></strong>
  Second code is</p>
  
  <pre><code>&lt;?php
          require("class-IXR.php");  
          $client = new IXR_Client('http://localhost/wp/xmlrpc.php');
  
          $USER = 'admin';
          $PASS = 'pass';
  
          $content['title'] = 'Test title '.mt_rand();
          $content['categories'] = array("NewCategory","Nothing");
          $content['description'] = '&lt;p&gt;Lorem ırmak ipsum dolor sit amet&lt;/p&gt;';
          $content['custom_fields'] = array( array('key' =&gt; 'my_custom_fied','value'=&gt;'yes') );
          $content['mt_keywords'] = array('foo','bar');
  
          if (!$client-&gt;query('metaWeblog.newPost','', $USER,$PASS, $content, true))
          {
              die( 'Error while creating a new post' . $client-&gt;getErrorCode() ." : ". $client-&gt;getErrorMessage());  
          }
          $ID =  $client-&gt;getResponse();
  
          if($ID)
          {
              echo 'Post published with ID:#'.$ID;
          }
  
  ?&gt;
  </code></pre>
  
  <p>This was the two different way to send post to wordpress by xml-rpc. But chacters different than english doesnt work. What i know there is utf-8 support of xml-rpc.</p>
  
  <ul>
  <li>I have already checked many sites and there was a solution with dead link.
  dead link is <a href="http://thr.gen.tr/php/xmlrpc-turkce-karakter-sorunu.html" rel="nofollow">http://thr.gen.tr/php/xmlrpc-turkce-karakter-sorunu.html</a></li>
  </ul>