From c7e004efa1a262d91ace27ccc3f48ffcf95e69c1 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sat, 10 Dec 2016 11:24:40 +0100 Subject: [PATCH] PCH #include scanner: force string encoding to be UTF-8 If the locale is set to non-UTF-8 when (d)rake is invoked then Ruby will set the encoding of all strings read from files to US-ASCII. As several source files do use non-ASCII characters this results in warnings from Ruby about "invalid byte sequence in US-ASCII". As all of my source code files are encoded in UTF-8 we can simply enforce this. This happens when building the RPMs which sets the locale to C. --- rake.d/pch.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/rake.d/pch.rb b/rake.d/pch.rb index 9fc3fa098..a450073b8 100644 --- a/rake.d/pch.rb +++ b/rake.d/pch.rb @@ -383,6 +383,7 @@ PCH status: <%= c?(:USE_PRECOMPILED_HEADERS) ? "enabled" : "disabled" %> input = indirect ? indirect : user File.open(input) do |f| f.each_line do |line| + line.force_encoding("UTF-8") next if !@scan_include_re.match(line) @scan_candidates.each do |pair| (dir,header) = *pair