summary refs log tree commit diff
path: root/synapse/util/stringutils.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-07-03 11:26:06 +0100
committerErik Johnston <erik@matrix.org>2015-07-03 11:26:06 +0100
commitc0a975cc2e784c497219824b8f1fb5a757ba4606 (patch)
tree78f7cef9678e1e6d12f72d8de988443c8a72fb5a /synapse/util/stringutils.py
parentOops: underride rule had an identifier with override in it. (diff)
parentIf user supplies filename in URL when downloading from media repo, use that n... (diff)
downloadsynapse-c0a975cc2e784c497219824b8f1fb5a757ba4606.tar.xz
Merge pull request #195 from matrix-org/erikj/content_disposition
Add Content-Disposition headers to media repo downloads
Diffstat (limited to 'synapse/util/stringutils.py')
-rw-r--r--synapse/util/stringutils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/util/stringutils.py b/synapse/util/stringutils.py
index 52e66beaee..7a1e96af37 100644
--- a/synapse/util/stringutils.py
+++ b/synapse/util/stringutils.py
@@ -33,3 +33,12 @@ def random_string_with_symbols(length):
     return ''.join(
         random.choice(_string_with_symbols) for _ in xrange(length)
     )
+
+
+def is_ascii(s):
+    try:
+        s.encode("ascii")
+    except UnicodeDecodeError:
+        return False
+    else:
+        return True