From 117776e0c01e68a8b65584d86d7b8b56fe75c9d0 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Thu, 23 Feb 2017 14:04:45 +0100 Subject: Add a function to normalize CR and CRLF-style newlines to Unix LF See Bug #5306. --- src/etc/inc/util.inc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/etc/inc/util.inc') diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 937f899..604c557 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -2689,4 +2689,10 @@ function get_duid_from_file() { } return($duid_ASCII); } + +/* Replaces the Mac OS 9 and earlier (\r) and DOS/Windows (\r\n) newlines with the Unix equivalent (\n). */ +function unixnewlines($text) { + return preg_replace('/\r\n?/', "\n", $text); +} + ?> -- cgit v1.1