summary refs log tree commit diff
path: root/synapse/util/stringutils.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-07-08 15:37:33 +0100
committerErik Johnston <erik@matrix.org>2015-07-08 15:37:33 +0100
commit304343f4d7502d65ff7977df466209ef4702b90c (patch)
tree0eb1002013d40ef65dcd82e630859c467b3e6ec7 /synapse/util/stringutils.py
parentAdd a cache to fetching of receipt streams (diff)
parentMerge pull request #197 from matrix-org/mjark/missing_regex_group (diff)
downloadsynapse-304343f4d7502d65ff7977df466209ef4702b90c.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/receipts
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