There is also another technic ghia for unicode and UTF character sets you can use if you are with the later version of XOOPS 2.4.0 the following field types in the class:
Quote:
XOBJ_DTYPE_UNICODE_TXTBOX
XOBJ_DTYPE_UNICODE_TXTAREA
XOBJ_DTYPE_UNICODE_URL
XOBJ_DTYPE_UNICODE_EMAIL
XOBJ_DTYPE_UNICODE_ARRAY
XOBJ_DTYPE_UNICODE_OTHER
Infact these field types have been included cause not all UTF online is UTF8 there is also UTF16 and UTF32 as well as unicode. With these field types you can for example in a forum have mixed language content thats is a thread which has one entry in spanish the next one in chinese and the last in zulu.
To change these around to this you have to make the change in your class constructor.. For example:
*** Old Class ***
// $Autho: wishcraft $
if (!defined('XOOPS_ROOT_PATH')) {
exit();
}
/**
* Class for compunds
* @author Simon Roberts
* @copyright copyright (c) 2009-2003 XOOPS.org
* @package kernel
*/
class VidshopVideo_category extends XoopsObject
{
function VidshopVideo_category($id = null)
{
$this->initVar('cid', XOBJ_DTYPE_INT, null, false);
$this->initVar('weight', XOBJ_DTYPE_INT, 1, false);
$this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 128);
$this->initVar('image', XOBJ_DTYPE_OTHER, null, false, 255);
$this->initVar('description', XOBJ_DTYPE_OTHER, null, false);
}
}
/**
* XOOPS policies handler class.
* This class is responsible for providing data access mechanisms to the data source
* of XOOPS user class objects.
*
* @author Simon Roberts
* @package kernel
*/
class VidshopVideo_categoryHandler extends XoopsPersistableObjectHandler
{
function __construct(&$db)
{
$this->db = $db;
parent::__construct($db, "vidshop_video_category", 'VidshopVideo_category', "cid", "name");
}
}
?>
You would change this to this to support any form of language regardless of the database support.
// $Autho: wishcraft $
if (!defined('XOOPS_ROOT_PATH')) {
exit();
}
/**
* Class for compunds
* @author Simon Roberts
* @copyright copyright (c) 2009-2003 XOOPS.org
* @package kernel
*/
class VidshopVideo_category extends XoopsObject
{
function VidshopVideo_category($id = null)
{
$this->initVar('cid', XOBJ_DTYPE_INT, null, false);
$this->initVar('weight', XOBJ_DTYPE_INT, 1, false);
$this->initVar('name', XOBJ_DTYPE_UNICODE_TXTBOX, null, true, 128);
$this->initVar('image', XOBJ_DTYPE_OTHER, null, false, 255);
$this->initVar('description', XOBJ_DTYPE_UNICODE_OTHER, null, false);
}
}
/**
* XOOPS policies handler class.
* This class is responsible for providing data access mechanisms to the data source
* of XOOPS user class objects.
*
* @author Simon Roberts
* @package kernel
*/
class VidshopVideo_categoryHandler extends XoopsPersistableObjectHandler
{
function __construct(&$db)
{
$this->db = $db;
parent::__construct($db, "vidshop_video_category", 'VidshopVideo_category', "cid", "name");
}
}
?>
This is being introduced for multiple types of database services in 2.5 as not all of them even have UTF support and MySQL is quiet limited. btw. Zulu is UTF-16 for example which MySQL doesn't support, but using this method it can still store the escaped 16 bits of data and display using the handling for it in object.php