This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 81816b2 Better handling of invalid encodings
81816b2 is described below
commit 81816b29151b8cf1557681c419dea545e4f2f6d9
Author: Sebb <[email protected]>
AuthorDate: Sun Feb 28 00:51:21 2021 +0000
Better handling of invalid encodings
---
lib/whimsy/asf/member-files.rb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/whimsy/asf/member-files.rb b/lib/whimsy/asf/member-files.rb
index 9786fb5..8e30f67 100644
--- a/lib/whimsy/asf/member-files.rb
+++ b/lib/whimsy/asf/member-files.rb
@@ -28,7 +28,11 @@ module ASF
# Find most recent file:
nomfile = Dir[File.join(ASF::SVN['Meetings'], '*', name)].max
+ # It does not appear to be possible to have file open or read
+ # automatically transcode strings, so we do it here.
+ # This is necessary to avoid issues with matching Regexes.
File.open(nomfile, mode='rb:UTF-8')
+ .map{|l| l.encode('utf-8', invalid: :replace)}
.slice_before(/^\s*---+--\s*/)
.drop(2) # instructions and sample block
.each do |block|