diff --git a/include/simpleplugin/class_attribute.inc b/include/simpleplugin/class_attribute.inc
index a1e38c2445f44a8e8882c53e16acaf8c5258100d..ab7a6a30205abfc811faf749a92761ce06c56614 100644
--- a/include/simpleplugin/class_attribute.inc
+++ b/include/simpleplugin/class_attribute.inc
@@ -149,14 +149,21 @@ class Attribute
     $this->manageAttributes($this->value);
   }
 
+  /*! \brief Set the postValue */
   function setPostValue ($value)
   {
     if ($this->isVisible()) {
-      $this->postValue = $value;
+      $this->postValue = $this->fixPostValue($value);
       $this->manageAttributes($this->postValue);
     }
   }
 
+  /*! \brief In case a treatment is needed on POST content */
+  function fixPostValue ($value)
+  {
+    return $value;
+  }
+
   /*! \brief Reset this attribute to its default value
    */
   function resetToDefault ()
@@ -864,6 +871,12 @@ class StringAttribute extends Attribute
     return $this->renderAcl($display);
   }
 
+  function fixPostValue ($value)
+  {
+    /* Replace CRLF by LF, to avoid non-ASCII chars in multiline values (mainly useful for textarea) */
+    return str_replace(array("\r\n", "\r"), "\n", $value);
+  }
+
   function check ()
   {
     $error = parent::check();
@@ -1614,10 +1627,11 @@ class FileAttribute extends Attribute
    */
   function readFile($handle)
   {
-    $this->postValue = fread($handle, 1024);
+    $postValue = fread($handle, 1024);
     while (!feof($handle)) {
-      $this->postValue .= fread($handle, 1024);
+      $postValue .= fread($handle, 1024);
     }
+    $this->setPostValue($postValue);
     @fclose($handle);
   }
 
@@ -1758,6 +1772,12 @@ class FileTextAreaAttribute extends FileDownloadAttribute
     return $this->renderAcl($display).parent::renderFormInput();
   }
 
+  function fixPostValue ($value)
+  {
+    /* Replace CRLF by LF, to avoid non-ASCII chars */
+    return str_replace(array("\r\n", "\r"), "\n", $value);
+  }
+
   public function htmlIds()
   {
     $ids    = parent::htmlIds();