This commit is contained in:
Laurent Destailleur 2026-01-24 18:07:53 +01:00
parent 27026eced9
commit 6b8214ea6a
2 changed files with 13 additions and 9 deletions

View file

@ -862,13 +862,15 @@ class Translate
/**
* Convert a string into output charset (this->charset_output that should be defined to conf->file->character_set_client)
*
* @param string $str String to convert
* @param string $pagecodefrom Page code of src string
* @param string $pagecodeto Expected page code of returned string
* @return string Converted string
* @param string|null $str String to convert
* @param string $pagecodefrom Page code of src string
* @param string $pagecodeto Expected page code of returned string
* @return string Converted string
*/
public function convToOutputCharset($str, $pagecodefrom = 'UTF-8', $pagecodeto = '')
{
$str = (string) $str;
if (empty($pagecodeto)) {
$pagecodeto = $this->charset_output;
}

View file

@ -1915,16 +1915,18 @@ function dol_size($size, $type = '')
* Clean a string to use it as a file name.
* Replace also '--' and ' -' strings, they are used for parameters separation (Note: ' - ' is allowed).
*
* @param string $str String to clean
* @param string $newstr String to replace bad chars with.
* @param int $unaccent 1=Remove also accent (default), 0 do not remove them
* @param int $includequotes 1=Include simple quotes (double is already included by default)
* @return string String cleaned
* @param string|null $str String to clean
* @param string $newstr String to replace bad chars with.
* @param int $unaccent 1=Remove also accent (default), 0 do not remove them
* @param int $includequotes 1=Include simple quotes (double is already included by default)
* @return string String cleaned
*
* @see dol_string_nospecial(), dol_string_unaccent(), dol_sanitizePathName()
*/
function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1, $includequotes = 0)
{
$str = (string) $str;
// List of special chars for filenames in windows are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
// Char '>' '<' '|' '$' and ';' are special chars for shells.
// Char '/' and '\' are file delimiters.