Fix: Use filesystem encoding

This commit is contained in:
Laurent Destailleur 2011-12-01 23:36:00 +01:00
parent 6189acc3b4
commit 061be9ca47

View File

@ -466,12 +466,12 @@ class CMailFile
/** /**
* Read a file on disk and return encoded content for emails (mode = 'mail') * Read a file on disk and return encoded content for emails (mode = 'mail')
* *
* @param sourcefile * @param string $sourcefile Path to file to encode
* @return <0 if KO, encoded string if OK * @return int <0 if KO, encoded string if OK
*/ */
function _encode_file($sourcefile) function _encode_file($sourcefile)
{ {
$newsourcefile=utf8_check($sourcefile)?utf8_decode($sourcefile):$sourcefile; // is_readable and file_get_contents need ISO filename $newsourcefile=dol_osencode($sourcefile);
if (is_readable($newsourcefile)) if (is_readable($newsourcefile))
{ {
@ -481,7 +481,7 @@ class CMailFile
} }
else else
{ {
$this->error="Error: Can't read file '$sourcefile'"; $this->error="Error: Can't read file '".$sourcefile."' into _encode_file";
dol_syslog("CMailFile::encode_file: ".$this->error, LOG_ERR); dol_syslog("CMailFile::encode_file: ".$this->error, LOG_ERR);
return -1; return -1;
} }
@ -491,6 +491,8 @@ class CMailFile
/** /**
* Write content of a SMTP request into a dump file (mode = all) * Write content of a SMTP request into a dump file (mode = all)
* Used for debugging. * Used for debugging.
*
* @return void
*/ */
function dump_mail() function dump_mail()
{ {