UseModWiki | WikiPatches | RecentChanges | Preferences

Strange characters on line-ends:

This patch will be part of the NextRelease after 0.92 --CliffordAdams

Additional spaces appear on the end of the lines on my Linux-based installation when editing with Linux Netscape (haven't tested with others).

Also, when someone edits pages with Windows IE, additional ``newlines`` crawl in... :-(

Making this change to an existing installation may cause false diffs for the fist edit of each page. Perhaps the following linux commands executed from the top directory of the database will prevent this:
        find page -type f -name '*.db' | xargs fromdos -a -b -v
        find keep -type f -name '*.kp' | xargs fromdos -a -b -v

Is removing carriage returns really the correct thing to do? Both Windows and Linux browsers seem to generate CRLF's in posted text. Furthermore removing the CR's causes text on separate lines to run together without a separating space. In other words
appears as


--- usemod092/wiki.pl   Sun Apr 22 02:44:10 2001
+++ /usr/lib/cgi-bin/wiki.pl    Fri May  4 10:25:32 2001
@@ -3219,6 +3229,9 @@
   $summary =~ s/[\r\n]//g;
   # Add a newline to the end of the string (if it doesn't have one)
   $string .= "\n"  if (!($string =~ /\n$/));
+  # Remove "\r"-s (0x0d) from the string
+  $string =~ s/\r//g;

   # Lock before getting old page to prevent races
   &RequestLock() or die(T('Could not get editing lock'));

The above patch was modified by me as follows:

-  $string =~ s/\r//g;
+  $string =~ s/\r\n/\n/g;
+  $string =~ s/\r/\n/g;

Reason: some Macintosh browser will not insert an LF at all. CR is the default for line endings on a Macintosh. If you strip them out some Macintosh users will not be able to create new lines/paragraphs at all. My patch will:

It works for me, with any browser that I'm aware of. --OL

UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited April 21, 2005 10:02 pm by MUBA (diff)