Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: 1 [2]   Go Down

Author Topic: 1.4.1 - keyword list return incorrect result for chinese characters (utf8)  (Read 16633 times)

0 Members and 1 Guest are viewing this topic.

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
Re: 1.4.1 - keyword list return incorrect result for chinese characters (utf8)
« Reply #20 on: November 27, 2005, 01:26:13 am »

nvm here it is: http://dragonflycms.org/unicode/?p=60#12288

I've wrapped it up in pages constisting of 150 chars on each page or your browser might choke in it

DJMAZE,

The use of Japanese or Chinese characters in other places works as expected.  The real issue, as I see it, is that when someone using CPG in Japanese or Chinese tries to input Kanji as their keywords and hits the spacebar between each set of Kanji to separate each "keyword", the keyword manager will save this as:

keyword1&#12288 ;keyword2&#12288 ;keyword3  (without the space between 8 and  ; )

rather than:

keyword1 keyword2 keyword3   (where the spaces are the &#32 ; (latin) variety.)

therefore the search engine would read:
the first example as ONE word not three separate words and list it as ONE word at the bottom of the search page.  The keyword manager would read the entry as ONE keyword as well and therefore the linking feature would fail to work.  If I literally replace the &#12288 with ' ' (latin space), there is no problem.  We need to replace the &#12288 character with ' ' (latin equivalent) JUST FOR THE KEYWORD field before it is saved to the database.

(Hope you didn't read this when I had %20 in there...   cuz %20 wouldn't work either.)

Dennis
« Last Edit: November 27, 2005, 01:46:15 am by madeinhawaii »
Logged
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

DJMaze

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 831
    • Dragonfly CMS
Re: 1.4.1 - keyword list return incorrect result for chinese characters (utf8)
« Reply #21 on: November 27, 2005, 03:46:17 am »

I understood was thinking ahead regarding other issues but posted in this topic instead of the correct forum.

Anyway as seen on unicode page use the hex code and the following code change might work (someone needs to test)

thumbnails.php around line 93:
Code: [Select]
$USER['search'] = $_POST;
$album = 'search';
}
Replace with:
Code: [Select]
$USER['search'] = $_POST;
$USER['search']['search'] = preg_replace('#[\xE3][\x80][\x80]#', ' ', $USER['search']['search']);
$album = 'search';
}
« Last Edit: November 27, 2005, 03:55:49 am by DJMaze »
Logged
There are 2 kinds of users in this world: satisfied and complainers.
Why do we never hear something from the satisfied users?
http://coppermine-gallery.net/forum/index.php?topic=24315.0

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
Re: 1.4.1 - keyword list return incorrect result for chinese characters (utf8)
« Reply #22 on: November 27, 2005, 04:31:49 am »

@DJMAZE

Sorry, didn't do anything really.
it allowed for searching of independent characters separated by the space, but it did not resolve the issue of all the characters being strung together as ONE keyword.

In other words, if I type in three different  keywords in Japanese/Chinese separated by spaces and save the settings, all three end up as ONE keyword because the asian space character is not recognized by CPG as a separator of keywords, thereby defeating the linking feature of different keywords.   

So the character replacement has to occur even before it is saved to the database OR better yet,  the asian space character must also be recognized by CPG as a legitimate space character.

Dennis

Logged
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

DJMaze

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 831
    • Dragonfly CMS
Re: 1.4.1 - keyword list return incorrect result for chinese characters (utf8)
« Reply #23 on: November 27, 2005, 04:25:14 pm »

The above mentioned code is only for fixing the search itself, not the keywords.
Since it works here's the fix for the keywords:

editOnePic.php around line 41 replace:
Code: [Select]
    $title        = $_POST['title'];
    $caption      = $_POST['caption'];
    $keywords     = $_POST['keywords'];
    $user1        = $_POST['user1'];
    $user2        = $_POST['user2'];
with
Code: [Select]
    $title        = $_POST['title'];
    $caption      = $_POST['caption'];
    $keywords     = preg_replace('#[\xE3][\x80][\x80]#', ' ', $_POST['keywords']);
    $user1        = $_POST['user1'];
    $user2        = $_POST['user2'];
Logged
There are 2 kinds of users in this world: satisfied and complainers.
Why do we never hear something from the satisfied users?
http://coppermine-gallery.net/forum/index.php?topic=24315.0

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
Re: 1.4.1 - keyword list return incorrect result for chinese characters (utf8)
« Reply #24 on: November 27, 2005, 06:07:15 pm »

@DJMAZE

Pefect!   I tried it as a keyword link, keyword for search, and then I tried searching for a particular Japanese/Chinese character and phrase when the Kanji was in the caption and title.  All work.

Dennis
Logged
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

DJMaze

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 831
    • Dragonfly CMS
Re: 1.4.1 - keyword list return incorrect result for chinese characters (utf8)
« Reply #25 on: November 27, 2005, 06:16:48 pm »

Bugfix added to cvs 'devel' module.
Needs testing and if it works i will commit to 'stable'

/devel/editOnePic.php new revision: 1.43
/devel/thumbnails.php new revision: 1.31
/devel/include/functions.inc.php new revision: 1.209

Logged
There are 2 kinds of users in this world: satisfied and complainers.
Why do we never hear something from the satisfied users?
http://coppermine-gallery.net/forum/index.php?topic=24315.0
Pages: 1 [2]   Go Up
 

Page created in 0.016 seconds with 18 queries.