summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/Client/Tools/POSIX.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/Client/Tools/POSIX.py b/src/lib/Client/Tools/POSIX.py
index 8576f49fa..55e83d822 100644
--- a/src/lib/Client/Tools/POSIX.py
+++ b/src/lib/Client/Tools/POSIX.py
@@ -357,7 +357,12 @@ class POSIX(Bcfg2.Client.Tools.Tool):
return False
tempdata = entry.text
if type(tempdata) == unicode:
- tempdata = tempdata.encode(self.setup['encoding'])
+ try:
+ tempdata = tempdata.encode(self.setup['encoding'])
+ except UnicodeEncodeError, e:
+ self.logger.error("Error encoding file %s:\n %s" % \
+ (entry.get('name'), e))
+ return False
try:
content = open(entry.get('name')).read()
except IOError, error: