File: 1003_utf8_flag.patch

package info (click to toggle)
libre-engine-re2-perl 0.17%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 444 kB
  • sloc: cpp: 271; perl: 80; makefile: 2; sh: 1
file content (26 lines) | stat: -rw-r--r-- 857 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Description: fix flag all captures as UTF8
Origin: https://rt.cpan.org/Public/Bug/Display.html?id=131618
Author: Todd Richmond <trichmond@proofpoint.com>
Bug: https://rt.cpan.org/Public/Bug/Display.html?id=116747
Bug: https://rt.cpan.org/Public/Bug/Display.html?id=131618
Last-Update: 2020-02-22
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/re2_xs.cc
+++ b/re2_xs.cc
@@ -101,10 +101,13 @@
     // XXX: Need to compile two versions?
     /* The pattern is not UTF-8. Tell RE2 to treat it as Latin1. */
 #ifdef RXf_UTF8
-    if (!(flags & RXf_UTF8))
+    if (flags & RXf_UTF8)
+        extflags |= RXf_MATCH_UTF8;
 #else
-    if (!SvUTF8(pattern))
+    if (SvUTF8(pattern))
+        extflags |= RXf_MATCH_UTF8;
 #endif
+    else
         options.set_encoding(RE2::Options::EncodingLatin1);
 
     options.set_log_errors(false);