CSV Export - encode quotes #808

This commit is contained in:
jokob-sk
2024-09-29 08:18:00 +10:00
parent e3b2039257
commit 02077d4654
4 changed files with 51 additions and 14 deletions

View File

@@ -524,6 +524,25 @@ function handleNull ($text, $default = "") {
}
// -------------------------------------------------------------------------------------------
// Encode special chars
function encodeSpecialChars($str) {
return str_replace(
['&', '<', '>', '"', "'"],
['&amp;', '&lt;', '&gt;', '&quot;', '&#039;'],
$str
);
}
// -------------------------------------------------------------------------------------------
// Decode special chars
function decodeSpecialChars($str) {
return str_replace(
['&amp;', '&lt;', '&gt;', '&quot;', '&#039;'],
['&', '<', '>', '"', "'"],
$str
);
}
// -------------------------------------------------------------------------------------------