OSDN Git Service

Include UTF-8 multibyte processing.
authorsakamocchi <sakamocchi@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Wed, 19 Jan 2011 08:32:30 +0000 (08:32 +0000)
committersakamocchi <sakamocchi@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Wed, 19 Jan 2011 08:32:30 +0000 (08:32 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@1092 1ca29b6e-896d-4ea0-84a5-967f57386b96

utf8/nucleus/xmlrpc/server.php

index 0266c09..e1c71a0 100755 (executable)
@@ -73,7 +73,8 @@ include_libs('xmlrpc.inc.php',false,false);
 include_libs('xmlrpcs.inc.php',false,false);
 
 /* define xmlrpc settings */
-$xmlrpc_internalencoding = _CHARSET;
+//$xmlrpc_internalencoding = _CHARSET;
+$xmlrpc_internalencoding = 'UTF-8';
 $xmlrpc_defencoding = 'UTF-8';
 
 /* definition of available methods */
@@ -133,6 +134,12 @@ function _addDatedItem($blogid, $username, $password, $title, $body, $more, $pub
        if ($closed != 1)
                $closed = 0;
 
+       if (strtolower(_CHARSET) != 'utf-8') {
+               $title = mb_convert_encoding($title, _CHARSET, "UTF-8");\r
+               $body = mb_convert_encoding($body, _CHARSET, "UTF-8");\r
+               $more = mb_convert_encoding($more, _CHARSET, "UTF-8");\r
+       }
+
        // 4. add to blog
        $itemid = $blog->additem($catid, $title, $body, $more, $blogid, $mem->getID(), $timestamp, $closed, $draft);
 
@@ -158,6 +165,12 @@ function _edititem($itemid, $username, $password, $catid, $title, $body, $more,
        if (!$mem->canAlterItem($itemid))
                return _error(7,"Not allowed to alter item");
 
+       if (strtolower(_CHARSET) != 'utf-8') {
+               $title = mb_convert_encoding($title, _CHARSET, _CHARSET.",UTF-8");\r
+               $body = mb_convert_encoding($body, _CHARSET, _CHARSET.",UTF-8");\r
+               $more = mb_convert_encoding($more, _CHARSET, _CHARSET.",UTF-8");\r
+       }
+
        // 3. update item
        ITEM::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, 0);