Dekiwiki NG in Japanese

    What is NG, no good, or doesn't work, in the Japanese language.

    日本語でNGな部分。

    Lucene Search of Attachments 添付の検索 (Resolved for PDF, DOC, XLS, PPT)

    Lucene in Deki Wiki is set up to index attachments by converting them to text using "filters". The filters are installed as packages, and then somehow copied to /var/www/deki-hayes/bin/filters, where they are referenced by the startup xml file /var/www/deki-hayes/config/mindtouch.deki.startup.xml.

    However, while Lucene search is working in Japanese for wiki pages (after cursory testing), it is not working for attachments. From reading some pages on the internet, it seems that these filter utilities have to be set to work in Japanese.

    See the forum post as well:
    http://forums.opengarden.org/showthr...=6454#post6454 

    Resolved

    This problem is resolved for PDF, DOC, XLS, PPT, confirmed on Ubuntu 7.11. 

    PDF Export

    PDF export does not work, and produces all entities and garbage.

    If printing via the OS, printing directly via the print dialog, or, via the page directly (and therefore using print.css if it exists) is not so desireable and could be improved.  

    Problem with Date Formatting 日付の表示方式

    The basic date formatting is "western" style, so that when translated, the resulting dates look like "15 11月 2007" which is not good in the Japanese language and standard. In Japan, the usual way of formatting dates would be YYYY MM DD. One way of handling this would be to allow some kind of setting to be made to fix the problem, but, in the long run it would be better to fundamentally fix the problem, by following W3C-DTF formats to make things clear and simple.  

    現在日付の表記方法が欧米方式の、DD MM YYYYになっているが、単純に訳してしまうと、「15 11月 2007」のようになってしまい、日本で利用する際には大きな問題がある。(日本ではYYYY MM DDが一般的)初期設定等で変更できるような仕組みを持つことが望ましいが、本来であれば日付の表記方法はW3C-DTFフォーマットに従い統一表記とするのが一番シンプルかつ明瞭であると思われる。

     

     W3C-DTF formatted dates - 6 types
    W3C-DTFフォーマットで勧告されている6種類の日付表記方法
    1. Year Only
      YYYY
      (e.g: 2001
    2. Year and Date
      YYYY
      -MM(e.g: 2001-08
    3. Year, Month, Day
      YYYY
      -MM-DD(e.g: 2001-08-02
    4. Year, Month, Day, Time
      YYYY
      -MM-DDThh:mmTZD(e.g: 2001-08-02T10:45+09:00
    5. Year, Month, Day, Time with Seconds
      YYYY
      -MM-DDThh:mm:ssTZD(e.g: 2001-08-02T10:45:23+09:00
    6. Year, Month, Day, Time, Seconds with Minutes
      YYYY
      -MM-DDThh:mm:ss.sTZD(e.g: 2001-08-02T10:45:23.5+09:00
    1. 年のみ
      YYYY
      (例:2001
    2. 年月
      YYYY
      -MM(例:2001-08
    3. 年月日
      YYYY
      -MM-DD(例:2001-08-02
    4. 年月日および時分
      YYYY
      -MM-DDThh:mmTZD(例:2001-08-02T10:45+09:00
    5. 年月日および時分秒
      YYYY
      -MM-DDThh:mm:ssTZD(例:2001-08-02T10:45:23+09:00
    6. 年月日および時分秒および小数部分
      YYYY
      -MM-DDThh:mm:ss.sTZD(例:2001-08-02T10:45:23.5+09:00

     

    Reference

    Please see the following URL 詳しくはこちら
    http://www.w3.org/TR/NOTE-datetime

    Tag page
    Viewing 15 of 16 comments: view all
    どうも問題は日本語がHTML Entitiesになること。添付をします。
    Posted 18:41, 11 Nov 2007
    UTF-8でURLエンコードされてしまうようですね。
    どこもオープンソースのWebアプリケーションではPDFの日本語化が難航しているようです。
    それだけに是非DekiWikiでは実現したいですね。
    私も調べてみます。
    Posted 19:24, 11 Nov 2007
    お役に立てるか分かりませんがHTMLからPDF変換を行うもの

    TCPDF
    UTF8に標準で対応しているので仕組みの参考にはなるかもしれません。
    http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf edited 19:41, 11 Nov 2007
    Posted 19:41, 11 Nov 2007
    Thanks for the comments, Mio san.

    To the Mindtouch team: Mio points out and I concur that it looks like you're having problems that other Open Source apps have, with export to PDF for Japanese.

    Mio san mentions an URL that might be of some help:

    http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf
    Posted 04:57, 13 Nov 2007
    The two tools we use for PDF generation are: HTML2PS and PS2PDF. I believe both these tools support Unicode output, but may require files (like font packs) or some minor configuration. edited 17:46, 14 Nov 2007
    Posted 17:45, 14 Nov 2007
    Thanks RoyK.
    Posted 21:38, 14 Nov 2007
    日付の表記方法について現在は欧米方式(DD MM YYYY)であるため、日本でそのまま使用する際には少々問題があるようです。日本で一般的なYYYY MM DDに変更することは可能なのでしょうか?
    Posted 05:40, 17 Nov 2007
    Hello Mindtouch: Mio pointed out in Japanese some problems with date formatting in the Japanese translation. Please see her comments above (mistakes in the J-E translation of her comments are mine, if any.)
    Posted 04:40, 19 Nov 2007
    キーワード検索した後のハイライト表示機能で、日本語の検索ワードだと、ハイライトしなないようです。
    Posted 20:29, 20 Nov 2007
    Export.csの14行目にて不具合が起こっているようですね。

    MemoryStream stdIn = new MemoryStream(Encoding.UTF8.GetBytes(content.ToXHtml()));

    上記、ToXHtmlにてマルチバイト文字列が数値実体参照に変換されてしまっております。
    引き続き、調査してみます。 edited 00:37, 24 Mar 2008
    Posted 00:19, 24 Mar 2008

    日本語PDFの出力に関して、改善案をご紹介いたします。

    【問題1】Export.csにてHTMLコンテンツをToXHtml()する際に、マルチバイト文字列が数値実体参照に変換されてしまう

    【問題2】html2psがEUCJPのみをサポート

    【問題3】gs8.15でのps2pdfにおいて、CIDフォントでないとうまく日本語フォントが埋め込めない


    当方では、問題1および問題2に関して、Export.csの実装を変えることで解決しました。

    ==============================Export.cs 14行目==================================
    MemoryStream stdIn = new MemoryStream(Encoding.GetEncoding(51932).GetBytes(content.ToString(Encoding.GetEncoding(51932))));
    ==============================================================================

    問題3に関しては和田研フォントの採用で解決しました。

    生成PDFを添付いたしますが、改行が「?」に変換される?などの不具合も見られます。
    引き続き調査いたします。
    edited 19:13, 27 Mar 2008
    Posted 22:26, 24 Mar 2008
    >Samuraiさん
    ご対応ありがとうございます!生成PDFの改行が「?」になるということは、
    「tab」などフォントが存在しない文字(文字というのが適切か分かりませんが・・・)も同様ですかね。

    解決の方法が思いつきましたら、報告します。。。
    Posted 16:54, 25 Mar 2008

    >yutananさん
    では、調査よろしくお願いします!

    当方で、検索ワードハイライトの不具合に関して調査いたしました。

    【問題】DreamのXDocWord.ConvertToWordListによるxhtmlコンテンツの単語分割が、日本語に対応できていない

    「検索できる」が「ハイライトできない」のは「Luceneの検索インデックスにはきちんと単語登録されている」のに「Dreamできちんと単語分割できない」ことが原因です。
    例を示します。

    ■例文:「本日は超晴天なり」

    《Dreamによる単語分割》
     →本日は
     →超
     →晴天なり

    この場合、LuceneとDreamの不整合により、下記現象が発生します。

    [Case1] 検索ワード:「本日」
     検索→OK
     ハイライト→NG

    [Case2] 検索ワード:「本日は」
     検索→OK
     ハイライト→OK


    解決策として「XDocWord.ConvertToWordListの実装を日本語対応させる」等が思いつきます。
    引き続き調査してみます。


    edited 06:36, 27 Mar 2008
    Posted 23:25, 26 Mar 2008


    検索ワードハイライトの不具合に関して、改善案をご報告します。

    ここではひとまず、DekiWikiの実装で解決(?)する方法をご紹介します。
    ハイライト判定をArray.BinarySearchではなく正規表現で実装しました。
    これによって、検索ワードを含む文をハイライトできます。
    この実装ではDreamの単語分割に手を加えないため、「検索ワード単位」でなく「検索ワードを含む文単位」でハイライトしてしまうというデメリットがあります。
    詳細は添付したキャプチャをご覧ください。

    ===============================DekiXmlParser.cs 1495行目付近================================

    // loop over all words in document
    foreach(XDocWord word in contentWords) {

    ///////////////
    //Edit starts//
    ///////////////
    if (word.IsWord)
    {
    foreach (string highlightendWord in highlightedWords)
    {
    Regex regex = new System.Text.RegularExpressions.Regex(@"(.*?)("+highlightendWord+")(.*?)");
    int[] gnums = regex.GetGroupNumbers();
    string target = word.Value.ToLowerInvariant();

    if (regex.Match(target).Success)
    {
    xhtml[word.Node].Replace(new XDoc("span").Attr("class", "highlight").Attr("style", "background-color: yellow; ").Add(xhtml[word.Node]));
    }

    }
    }

    /*
    // check if we word is in highlight list
    if(word.IsWord) {
    int index = Array.BinarySearch(highlightedWords, word.Value.ToLowerInvariant());
    if((index >= 0) && (index < highlightedWords.Length) && !ExcludedTags.Contains(word.Node, true)) {

    // replace word with its highlighted counterpart
    xhtml[word.Node].Replace(new XDoc("span").Attr("class", "highlight").Attr("style", "background-color: yellow; ").Add(xhtml[word.Node]));
    }
    }
    */
    /////////////
    //Edit ends//
    /////////////
    }
    }

    ===============================================================

    その他の手法に関しても調査してみます。
    edited 19:07, 27 Mar 2008
    Posted 18:59, 27 Mar 2008

    ハイライトの不具合に関して、DekiWikiの実装で解決する方法をご紹介します。
    添付のとおり、検索語をきちんとハイライトできます。
    <DekiWiki_Jp_highlight_02_-_ver_samurai_-_Japanese_Entities_Example.jpg>
    下記はDekiXmlParser.csの編集結果です。


    // loop over all words in document
    foreach(XDocWord word in contentWords) {

    ///////////////
    //Edit starts//
    ///////////////
    if (word.IsWord)
    {
    foreach (string highlightendWord in highlightedWords)
    {
    Regex regex = new System.Text.RegularExpressions.Regex(@"^(.*?)("+highlightendWord+")(.*?)$");
    int[] gnums = regex.GetGroupNumbers();
    string target = word.Value.ToLowerInvariant().ToString();

    string regexstring = "^(.*?)(" + highlightendWord + ")(.*?)";
    int match_count = 1;
    while (regex.Match(target).Success)
    {
    Regex r = new System.Text.RegularExpressions.Regex(@regexstring + "(" + highlightendWord + ")(.*?)$");

    if (!r.Match(target).Success)
    {
    break;
    }
    else
    {
    regexstring += "(" + highlightendWord + ")(.*?)";
    match_count++;
    }

    }
    regexstring +="$";

    Match match = new System.Text.RegularExpressions.Regex(@regexstring).Match(target);

    if (match.Success)
    {

    XDoc highlightendXDoc = new XDoc("span");
    for (int i = 1; i <= match_count*2+1; i++)
    {
    if (i % 2 == 1)
    {
    XDoc highlightendXDocGroup = new XDoc("span").Value(match.Groups[i]);
    highlightendXDoc.Add(highlightendXDocGroup);
    }else{
    XDoc highlightendXDocGroup = new XDoc("span").Attr("class", "highlight").Attr("style", "background-color: yellow; ").Value(match.Groups[i]);
    highlightendXDoc.Add(highlightendXDocGroup);
    }

    }

    xhtml[word.Node].Replace(highlightendXDoc);
    }

    }
    }

    /*
    // check if we word is in highlight list
    if(word.IsWord) {
    int index = Array.BinarySearch(highlightedWords, word.Value.ToLowerInvariant());
    if((index >= 0) && (index < highlightedWords.Length) && !ExcludedTags.Contains(word.Node, true)) {

    // replace word with its highlighted counterpart
    xhtml[word.Node].Replace(new XDoc("span").Attr("class", "highlight").Attr("style", "background-color: yellow; ").Add(xhtml[word.Node]));
    }
    }
    */
    /////////////
    //Edit ends//
    /////////////
    }
    } edited 05:31, 30 Mar 2008
    Posted 05:29, 30 Mar 2008
    Viewing 15 of 16 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by