sheevazz / searchable-behaviour-for-cakephp

Automatically exported from code.google.com/p/searchable-behaviour-for-cakephp
0 stars 0 forks source link

non-ascii chars saved as two? entities #8

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. try and save text with something like ñ, á or the like
2. do a select from the search_index table
3. comes out as ~n, 'a...

What is the expected output? What do you see instead?
I see 'a and ~n instead of á or ñ.

What version of the product are you using? On what operating system?
The Mark Story patch for the behaviour with cake 1.2 RC3, php 5.2.6 and
MySQL 5.0.51 on Windows. Note that in general, Cake works fine with accents.

Original issue reported on code.google.com by mora...@gmail.com on 4 Dec 2008 at 5:12

GoogleCodeExporter commented 9 years ago
commenting $index = iconv('UTF-8', 'ASCII//TRANSLIT', $index); solved my 
problem.
Looks ugly, but at least I can search.

Original comment by mora...@gmail.com on 4 Dec 2008 at 5:15

GoogleCodeExporter commented 9 years ago
adding
$q = iconv('UTF-8', 'ASCII//TRANSLIT', $q);
after
$q = Sanitize::escape($q);

also solves the problem.

Original comment by mora...@gmail.com on 4 Dec 2008 at 5:18

GoogleCodeExporter commented 9 years ago
Re 
http://code.google.com/p/searchable-behaviour-for-cakephp/issues/detail?id=8#c2 
:
Better use the added line _before_ the other, as searching for e.g. 'américa' 
will
try to query 
"SELECT [...] WHERE MATCH(`SearchIndex`.`data`) AGAINST('am'erica' IN BOOLEAN 
MODE)
[...]   "
and stuff will break.
So the resulting code looks like:
$q = iconv('UTF-8', 'ASCII//TRANSLIT', $q);
$q = Sanitize::escape($q);
$findOptions['conditions'] = array_merge(
    $findOptions['conditions'], array("MATCH(SearchIndex.data) AGAINST('$q' IN BOOLEAN
MODE)")
);

Original comment by mora...@gmail.com on 4 Dec 2008 at 5:58

GoogleCodeExporter commented 9 years ago
The default index function is using transliteration to speedup the searches.

The thing is that the problem lies within the indexing function itself not the
behavior; i'm not good at indexing data, so any other function to index the data
would be very apreciated.

Original comment by calin....@gmail.com on 10 Jun 2009 at 11:08

GoogleCodeExporter commented 9 years ago
Issue 9 has been merged into this issue.

Original comment by calin....@gmail.com on 10 Jun 2009 at 11:08