diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php
index a5fb62e7218..9254ed709df 100644
--- a/htdocs/includes/odtphp/odf.php
+++ b/htdocs/includes/odtphp/odf.php
@@ -206,9 +206,9 @@ class Odf
}
else {
$convertedValue = $this->encode_chars($convertedValue, $encode, $charset);
+ $convertedValue = preg_replace('/(\r\n|\r|\n)/i', "", $convertedValue);
}
- $convertedValue = preg_replace('/(\r\n|\r|\n)/i', "", $convertedValue);
return $convertedValue;
}
diff --git a/test/phpunit/ODFTest.php b/test/phpunit/ODFTest.php
index 7c859173326..5bcd9a72290 100644
--- a/test/phpunit/ODFTest.php
+++ b/test/phpunit/ODFTest.php
@@ -342,6 +342,14 @@ class ODFTest extends PHPUnit\Framework\TestCase
'charset' => null,
'expected' => "123 trucmachin > truc < troc > tracbla bla",
],
+
+ // HTML should not take \n into account, but only
.
+ 30 => [
+ 'to_convert' => "text with strong text , a line\nbreak and underlined words with it@lic sp&ciàlchärs éè l'",
+ 'encode' => false,
+ 'charset' => 'UTF-8',
+ 'expected' => 'text with strong text , a line'."\n".'break and underlined words with it@lic sp&ciàlchärs éè l\'',
+ ],
];
$odf=new Odf($filename, array());