文書の過去の版を表示しています。


DokuWikiの日本語対応

メールのエンコード

inc/mail.php

function mail_send

if(!utf8_isASCII($subject))

から

if($params == null){
  return @mail($to,$subject,$body,$header);
}else{
  return @mail($to,$subject,$body,$header,$params);
}

をコメントアウト。 かわりに

$header  = "From: $from\nCc: $cc\nBcc: $bcc";
$header .= $headers;
$header  = trim($header);
if($params == null){
  mb_send_mail($to,$subject,$body,$header);
}else{
  mb_send_mail($to,$subject,$body,$header,$params);
}

検索の日本語対応

MeCabのインストール

辞書は2.6.1まで。2.6.2以降はだめ。

dicrc

charset = utf8

% cd mecab-X.X.X/dic

./configure –prefix=/usr/local/nls –disable-shared –with-charset=utf8

全文検索インデクサーに分かち書きを

inc/indexer.php

どこか先頭に近いところに

define(JAPANESE_TOKENIZER,'/usr/local/nls/bin/mecab -O wakati');

function idx_getPageWords($page)の

    $body   = rawWiki($page);

の後ろに

  $dspec = array(
      0 => array("pipe", "r"),
      1 => array("pipe", "w"),
      2 => array("file", "/dev/null", "w")
  );
  $process = proc_open(JAPANESE_TOKENIZER, $dspec, $pipes);
  if(is_resource($process)) {
      fwrite($pipes[0], $body . "\n");
      fclose($pipes[0]);
  }
  $body = '';
  while(!feof($pipes[1])) {
      $body .= fgets($pipes[1], 32768);
  }
  fclose($pipes[1]);
  proc_close($process);

function idx_tokenizer($string,&$stopwords) の先頭

  $words = array();

の後ろ

  $dspec = array(
      0 => array("pipe", "r"),
      1 => array("pipe", "w"),
      2 => array("file", "/dev/null", "w")
  );
  $process = proc_open(JAPANESE_TOKENIZER, $dspec, $pipes);
  if(is_resource($process)) {
      fwrite($pipes[0], $string . "\n");
      fclose($pipes[0]);
  }
  $string = '';
  while(!feof($pipes[1])) {
      $string .= fgets($pipes[1], 32768);
  }
  fclose($pipes[1]);
  proc_close($process);
dokuwiki/install.1132909060.txt.gz · 最終更新: 2007/07/23 16:50 (外部編集)
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0