diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-11-17 01:34:36 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-11-17 01:34:36 +0100 |
commit | b891a80a33dfaf93de7d29d790fa312a1dc85ae1 (patch) | |
tree | eed7cace4ddae9df293bd7dd73a0169e7f16db92 /data | |
parent | aefc3887362b36cce5dc9906ad09c28ae6f8cb40 (diff) |
azgame plugin: strip BOM during wordlist loading
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/games/azgame.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/data/rbot/plugins/games/azgame.rb b/data/rbot/plugins/games/azgame.rb index 05b767f0..edff9093 100644 --- a/data/rbot/plugins/games/azgame.rb +++ b/data/rbot/plugins/games/azgame.rb @@ -134,7 +134,8 @@ class AzGamePlugin < Plugin def initialize_wordlist(lang) wordlist = @wordlist_base + lang.to_s if File.exist?(wordlist) - words = File.readlines(wordlist).map {|line| line.strip}.uniq + # wordlists are assumed to be UTF-8, but we need to strip the BOM, if present + words = File.readlines(wordlist).map {|line| line.sub("\xef\xbb\xbf",'').strip}.uniq if(words.length >= 4) # something to guess rules = { :good => /^\S+$/, |