Index: main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py	(revision 10027)
+++ main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py	(revision 10029)
@@ -73,4 +73,6 @@
 from waeup.kofa.students.export import EXPORTER_NAMES as STUDENT_EXPORTERS
 
+FORBIDDEN_CHARACTERS = (160,)
+
 grok.context(IKofaObject)
 grok.templatedir('templates')
@@ -1043,22 +1045,21 @@
             logger = self.context.logger
 
-            # XXX: temporary solution to prevent users from
-            # uploading non-ascii files.
-            #for element in filecontent:
-            #    try:
-            #        if ord(element) > 128:
-            #          self.flash(_(
-            #              "Only ASCII files are allowed. "
-            #              "Your file contains non-ASCII characters."))
-            #          logger.info('%s - non-ascii file uploaded: %s' %
-            #              (ob_class, target))
-            #          return
-            #    except TypeError:
-            #        self.flash(_(
-            #            "Only ASCII files are allowed. "
-            #            "Your file contains non-ASCII characters."))
-            #        logger.info('%s - non-ascii file uploaded: %s' %
-            #            (ob_class, target))
-            #        return
+            # Forbid certain characters in import files.
+            for element in filecontent:
+                try:
+                    if ord(element) in FORBIDDEN_CHARACTERS:
+                      self.flash(_(
+                          "Your file contains forbidden characters. "
+                          "Please replace."))
+                      logger.info('%s - invalid file uploaded: %s' %
+                          (ob_class, target))
+                      return
+                except TypeError:
+                    self.flash(_(
+                        "Your file contains forbidden characters. "
+                        "Please replace."))
+                    logger.info('%s - invalid file uploaded: %s' %
+                        (ob_class, target))
+                    return
 
             open(target, 'wb').write(filecontent)
Index: main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/forbidden_file.csv
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/forbidden_file.csv	(revision 10029)
+++ main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/forbidden_file.csv	(revision 10029)
@@ -0,0 +1,3 @@
+File with forbidden chracters
+
+This is character 160:  
Index: main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py	(revision 10027)
+++ main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py	(revision 10029)
@@ -36,4 +36,5 @@
 
 SAMPLE_FILE = os.path.join(os.path.dirname(__file__), 'test_file.csv')
+FORBIDDEN_FILE = os.path.join(os.path.dirname(__file__), 'forbidden_file.csv')
 
 class UniversitySetup(FunctionalTestCase):
@@ -144,4 +145,24 @@
         return
 
+    def test_forbidden_file_upload(self):
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(self.datacenter_path)
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.url, self.datacenter_path)
+        self.browser.getLink("Upload data").click()
+        file = open(FORBIDDEN_FILE)
+        ctrl = self.browser.getControl(name='uploadfile:file')
+        file_ctrl = ctrl.mech_control
+        file_ctrl.add_file(file, filename='my_corrupted_file.csv')
+        self.browser.getControl('Upload').click()
+        self.assertTrue(
+            'Your file contains forbidden characters. Please replace.'
+            in self.browser.contents)
+        logfile = os.path.join(
+            self.app['datacenter'].storage, 'logs', 'datacenter.log')
+        logcontent = open(logfile).read()
+        self.assertTrue('zope.mgr - browser.pages.DatacenterUploadPage - '
+            'invalid file uploaded:' in logcontent)
+        return
 
 class DataCenterUIExportTests(UniversitySetup, FunctionalAsyncTestCase):
