# HG changeset patch # User Martin Bornhold # Date 2016-09-21 13:17:08 # Node ID 7ca2d1dbc029868bb2e662cf0f58b0731e25fdbc # Parent 86b1e8f8dc5f50c1599937489519a47b1ffcc9f8 svn-support: Use utf-8 to encode mod_dav_svn configuration before writing to disk. Repository or group names may contain non ASCII characters. Therfore we have to encode the configuration before writing it to the file. diff --git a/rhodecode/svn_support/utils.py b/rhodecode/svn_support/utils.py --- a/rhodecode/svn_support/utils.py +++ b/rhodecode/svn_support/utils.py @@ -18,6 +18,7 @@ # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ +import codecs import logging import os @@ -79,8 +80,9 @@ def _write_mod_dav_svn_config(config, fi Write mod_dav_svn config to file. Log on exceptions but do not raise. """ try: - with open(filepath, 'w') as file_: - file_.write(config) + with codecs.open(filepath, 'w', encoding='utf-8') as f: + f.write(config) except Exception: log.exception( - 'Can not write mod_dav_svn configuration to "%s"', filepath) + 'Exception while writing mod_dav_svn configuration to ' + '"%s"', filepath)