val = cVariant(QString::fromUcs2(PyUnicode_AsUnicode(value)));
val = cVariant(QString::fromUcs2((ushort*)PyUnicode_AsUnicode(value)));
static int wpItem_setAttr( wpItem *self, char *name, PyObject *value ){	// Special Python things.	if( !strcmp( "events", name ) )	{		if( !PyList_Check( value ) )		{			PyErr_BadArgument();			return -1;		}		self->pItem->clearEvents();		int i;		for( i = 0; i < PyList_Size( value ); ++i )		{			if( !PyString_Check( PyList_GetItem( value, i ) ) )				continue;			cPythonScript *script = ScriptManager::instance()->find( PyString_AsString( PyList_GetItem( value, i ) ) );			if( script )				self->pItem->addEvent( script );		}	}	else if( !strcmp( "container", name ) )	{		if( checkWpItem( value ) )		{			P_ITEM pCont = getWpItem( value );			if( pCont )				pCont->addItem( self->pItem );		}		else if( checkWpChar( value ) )		{			P_CHAR pCont = getWpChar( value );			if( pCont )			{				tile_st tile = TileCache::instance()->getTile( self->pItem->id() );				if( tile.layer )				{					if( pCont->atLayer( (cBaseChar::enLayer)tile.layer ) )						pCont->atLayer( (cBaseChar::enLayer)tile.layer )->toBackpack( pCont );					pCont->addItem( (cBaseChar::enLayer)tile.layer, self->pItem );				}			}		}		else		{			self->pItem->removeFromCont();			self->pItem->moveTo( self->pItem->pos() );		}	}	else	{		cVariant val;		if( PyString_Check( value ) )			val = cVariant( PyString_AsString( value ) );		else if( PyUnicode_Check( value ) )			val = cVariant(QString::fromUcs2(PyUnicode_AsUnicode(value)));		else if( PyInt_Check( value ) )			val = cVariant( PyInt_AsLong( value ) );		else if( checkWpItem( value ) )			val = cVariant( getWpItem( value ) );		else if( checkWpChar( value ) )			val = cVariant( getWpChar( value ) );		else if( checkWpCoord( value ) )			val = cVariant( getWpCoord( value ) );		else if( PyFloat_Check( value ) )			val = cVariant( PyFloat_AsDouble( value ) );		if( !val.isValid() )		{			if( value->ob_type )				PyErr_Format( PyExc_TypeError, "Unsupported object type: %s", value->ob_type->tp_name );			else				PyErr_Format( PyExc_TypeError, "Unknown object type" );			return 0;		}		stError *error = self->pItem->setProperty( name, val );		if( error )		{			PyErr_Format( PyExc_TypeError, "Error while setting attribute '%s': %s", name, error->text.latin1() );			delete error;			return 0;		}	}	return 0;}