[fantasdic] Fixed bug in Epwing source.



commit 2637161a93b727c0f239d67dc0f4bdb61653c610
Author: Mathieu Blondel <mathieu mblondel org>
Date:   Thu Apr 15 11:21:50 2010 +0900

    Fixed bug in Epwing source.
    
    Some dictionaries may add null bytes at the beginning of definitions, making UTF8 string assertions fail in GTK.

 lib/fantasdic/sources/epwing_dictionary.rb |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/lib/fantasdic/sources/epwing_dictionary.rb b/lib/fantasdic/sources/epwing_dictionary.rb
index 42f381e..f2e24d4 100644
--- a/lib/fantasdic/sources/epwing_dictionary.rb
+++ b/lib/fantasdic/sources/epwing_dictionary.rb
@@ -100,8 +100,9 @@ class EpwingDictionary < Base
 
                 items.map do |head, contents|
                     defi = Definition.new
-                    defi.word = convert_to_utf8("euc-jp", head)
+                    defi.word = convert_to_utf8("euc-jp", head).gsub("\000", "")
                     defi.body = convert_to_utf8("euc-jp", contents)
+                    defi.body.gsub!("\000", "")
                     defi.database = name
                     defi.description = name.capitalize
                     defi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]