[pmwiki-users] ImportText end of line delimiters issue

Christophe David pmwiki at christophedavid.org
Tue Jun 26 01:22:13 CDT 2007


The ImportText recipe
(http://www.pmwiki.org/wiki/Cookbook/ImportText), does not always
handle the end of line delimiters adequately, especially when
importing files created on another platform than the one running
PmWIki.

The resulting PmWiki pages contain then "hard" delimiters instead of
having all the page content on one single "text=" line.

The following change fixed the issue for me.

import.php, line 142:

     $text = file_get_contents($fpath);

added:      $text = preg_replace('/(\\x0D\\x0A|\\x0A\\x0D)/', "\n", $text);

     $page = ReadPage($pn);
     $new = $page;
     $new['text'] = $text;
     UpdatePage($pn, $page, $new, $editfn);

May I suggest to include this in the next version of the recipe  ?

Christophe



More information about the pmwiki-users mailing list