diff --git a/src/common/optparser.py b/src/common/optparser.py
index 20c40ce7492aa3a0b9b3a9d249c5fe9adee74696..0dc670e6cf3189ba9e9bd3d8cc29def4e5072e60 100644
--- a/src/common/optparser.py
+++ b/src/common/optparser.py
@@ -17,6 +17,7 @@
 ##
 
 import os
+import sys
 import locale
 from common import gajim
 from common import i18n
@@ -85,6 +86,8 @@ def write_line(self, fd, opt, parents, value):
 	
 	def write(self):
 		(base_dir, filename) = os.path.split(self.__filename)
+		base_dir = base_dir.decode(sys.getfilesystemencoding())
+		filename = filename.decode(sys.getfilesystemencoding())
 		self.__tempfile = os.path.join(base_dir, '.' + filename)
 		try:
 			fd = open(self.__tempfile, 'w')