mercurial/pure/charencode.py
changeset 33926 f4433f2713d0
parent 33924 b9101467d88b
child 34217 5307cc57f271
--- a/mercurial/pure/charencode.py	Sun Apr 23 14:47:52 2017 +0900
+++ b/mercurial/pure/charencode.py	Sun Apr 23 12:59:42 2017 +0900
@@ -13,6 +13,13 @@
     pycompat,
 )
 
+def isasciistr(s):
+    try:
+        s.decode('ascii')
+        return True
+    except UnicodeDecodeError:
+        return False
+
 def asciilower(s):
     '''convert a string to lowercase if ASCII