I’m working on cakephp 1.3. I’m finding issue in character encoding. I’ve two model Keyword and Group, such that Keyword belongs to Group. What I’m trying to do is to perform full text query in model Keyword.
function geParentKeyword($keyword) {
//$keyword = *Acupuncturist*; Assuming this as input
$match = html_entity_decode("MATCH(Keyword.keyword) AGAINST (\"".trim($keyword)."\" IN BOOLEAN MODE)" );
return $this->find('first', array('fields' =>array('Group.name'), 'conditions' =>array($match) ));
}
I got wrong results with this query. I debug the query and I got this
SELECT `Group`.`name`
FROM `keywords` AS `Keyword`
LEFT JOIN `groups` AS `Group` ON (`Keyword`.`group_id` = `Group`.`id`)
WHERE MATCH(`Keyword`.`keyword`) AGAINST ("*Acupuncturist*" IN BOOLEAN MODE)
LIMIT 1"
The query is perfect but here the issue is at $match cake converts double quotes into " I tried with html_entity_decode and str_replace() but they show the same query.
For more details.
Core.php
Configure::write('App.encoding', 'UTF-8');
Database.php
var $default = array(
….
'encoding' => 'UTF8',
);
Expected result
MATCH(Keyword.keyword) AGAINST (' *Acupuncturist* ' IN BOOLEAN MODE)
Please guide me what is the issue. Thanks in advance.
I solve this by myself.
It was due to debug mode, I disable debug mode. It works only