wordpress XML-RPC UTF-8

I’m using the XML-RPC to add posts,and it’s works great But characters not correct (utf-8)

I’m using this

Read More
<?php
include('IXR_Library.php');
$client = new IXR_Client('http://localhost/wordpress2/xmlrpc.php');

        $content['title'] = 'Test title '.mt_rand();
        $content['categories'] = array("NewCategory","Nothing");
        $content['description'] = '<p>Lorem ?rmak ipsum dolor sit amet</p>';
        $content['custom_fields'] = array( array('key' => 'my_custom_fied','value'=>'yes') );
        $content['mt_keywords'] = array('foo','bar');
        $params = array(0, 'user','pass',$content,true);

//        if (!$client->query(xmlrpc_encode_request('metaWeblog.newPost',$params, array('encoding'=>'UTF-8','escaping'=>'markup')))) {
          if (!$client->query('metaWeblog.newPost',$params)) {
            die( 'Error while creating a new post' . $client->getErrorCode() ." : ". $client->getErrorMessage());
        }
        $ID =  $client->getResponse();

        if($ID)
        {
            echo 'Post published with ID:#'.$ID;
        }

?>

i think use xmlrpc_encode_request but not work

xmlrpc_encode_request('metaWeblog.newPost',$params, array('encoding'=>'UTF-8','escaping'=>'markup'))

How i will fix this?

Related posts

Leave a Reply