From b891a80a33dfaf93de7d29d790fa312a1dc85ae1 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 17 Nov 2008 01:34:36 +0100 Subject: azgame plugin: strip BOM during wordlist loading --- data/rbot/plugins/games/azgame.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'data') 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+$/, -- cgit v1.2.3