View Single Post
Old 02-04-2005, 10:40 PM   #3
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
This is an improvement to PhpDig v.1.8.8 RC1 handling of Japanese full/half-width characters (thanks to Edomondo).

In config.php find:
Code:
/***********************************************************************************************************************/
//---------PATH SETTINGS
And replace with:
Code:
/***********************************************************************************************************************/
//---------CONVERT JAPANESE KANA (only for Japanese)

define('ENABLE_JPKANA',false);                   // activates/deactivates japanese kana conversion
define('CONVERT_JPKANA','KVa');                  // see http://us2.php.net/manual/en/function.mb-convert-kana.php for options

/***********************************************************************************************************************/
//---------PATH SETTINGS
In robot_functions.php find the phpdigMakeUTF8 function.

In this function find:
Code:
if ($no_convert == 0) {
  return $string;
}
else {
  return 0;
}
And replace with:
Code:
if ($no_convert == 0) {
  if (ENABLE_JPKANA == true) {
    $string = @mb_convert_kana($string,CONVERT_JPKANA,"UTF-8");
  }
  return $string;
}
else {
  return 0;
}
In search_functions.php find:
Code:
if (!$option) {
     $option = SEARCH_DEFAULT_MODE;
}
if (!in_array($option,array('start','any','exact'))) {
     return 0;
}

if ($query_string) {
    $query_string = mb_eregi_replace("[?]*","",$query_string);
}

if ($query_string) {
    $query_string = phpdigVerifyUTF8($query_string);
}
And replace with:
Code:
if ($query_string) {
    if (ENABLE_JPKANA == true) {
      $query_string = @mb_convert_kana($query_string,CONVERT_JPKANA,"UTF-8");
    }
    $query_string = phpdigVerifyUTF8($query_string);
}
Also in search_functions.php find:
Code:
$query_to_parse = mb_ereg_replace('&[^ ]+','',$query_to_parse); // avoid &[chars] in the query
And afterwards add:
Code:
$query_to_parse = mb_ereg_replace('[?]*','',$query_to_parse); // avoid ? in the query
If you downloaded PhpDig v.1.8.8 RC1 after the date of this post, the changes are already included in the package.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline