From 9491a0aa0f2fcf15971956e48d21a1c886a80659 Mon Sep 17 00:00:00 2001 From: Brad Spengler Date: Tue, 19 Jul 2016 09:25:05 -0400 Subject: [PATCH] Set default encoding as Latin1 So re2 can be used as a drop-in replacement for re when searching for raw bytes Reported here months ago: https://github.com/axiak/pyre2/issues/38 --- src/re2.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/re2.pyx b/src/re2.pyx index 95b17c8e..3787d29b 100644 --- a/src/re2.pyx +++ b/src/re2.pyx @@ -947,7 +947,7 @@ def _compile(pattern, int flags=0, int max_mem=8388608): opts.set_max_mem(max_mem) opts.set_log_errors(0) - opts.set_encoding(_re2.EncodingUTF8) + opts.set_encoding(_re2.EncodingLatin1) # We use this function to get the proper length of the string.