diff --git a/rhodecode/lib/html_filters.py b/rhodecode/lib/html_filters.py
--- a/rhodecode/lib/html_filters.py
+++ b/rhodecode/lib/html_filters.py
@@ -18,8 +18,8 @@
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
-## base64 filter e.g ${ example | base64,n }
+# base64 filter e.g ${ example | base64,n }
def base64(text):
import base64
- from rhodecode.lib.helpers import safe_str
- return base64.encodestring(safe_str(text))
+ from rhodecode.lib.helpers import safe_str, safe_bytes
+ return safe_str(base64.encodebytes(safe_bytes(text)))