summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/games/azgame.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-11-17 01:34:36 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-11-17 01:34:36 +0100
commitb891a80a33dfaf93de7d29d790fa312a1dc85ae1 (patch)
treeeed7cace4ddae9df293bd7dd73a0169e7f16db92 /data/rbot/plugins/games/azgame.rb
parentaefc3887362b36cce5dc9906ad09c28ae6f8cb40 (diff)
azgame plugin: strip BOM during wordlist loading
Diffstat (limited to 'data/rbot/plugins/games/azgame.rb')
-rw-r--r--data/rbot/plugins/games/azgame.rb3
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+$/,