From 4cfc6cedc46c3bf95497290092a63028d6b4e3b2 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 19 Apr 2019 10:45:16 +0000 Subject: template/prelude.c.tmpl: allow UTF-8 characters git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- template/prelude.c.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'template/prelude.c.tmpl') diff --git a/template/prelude.c.tmpl b/template/prelude.c.tmpl index aa760dc054..99dc25fee8 100644 --- a/template/prelude.c.tmpl +++ b/template/prelude.c.tmpl @@ -45,6 +45,7 @@ class Prelude lines = [] result = [@preludes.size, @vpath.strip(filename), lines, sub] @vpath.foreach(filename) do |line| + line.force_encoding("ASCII-8BIT") if line.respond_to?(:force_encoding) @preludes[filename] ||= result comment = ($1 || '' if line.sub!(/(?:^|\s+)\#(?:$|[#\s](.*))/, '')) if line.size > LINE_LIMIT @@ -137,7 +138,7 @@ prelude_prefix_path(VALUE self) % unless preludes.empty? #define PRELUDE_NAME(n) rb_usascii_str_new_static(prelude_name##n, sizeof(prelude_name##n)-1) -#define PRELUDE_CODE(n) rb_usascii_str_new_static(prelude_code##n.L0, sizeof(prelude_code##n)) +#define PRELUDE_CODE(n) rb_utf8_str_new_static(prelude_code##n.L0, sizeof(prelude_code##n)) COMPILER_WARNING_PUSH #if GCC_VERSION_SINCE(4, 2, 0) COMPILER_WARNING_ERROR(-Wmissing-field-initializers) -- cgit v1.2.3