[Bugs] #3571 Words UNSP: Encoding error in Spanish (at least)

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Thu May 31 20:06:19 EDT 2012


#3571: Encoding error in Spanish (at least)
------------------------------------------+---------------------------------
    Reporter:  humitos                    |          Owner:  cjb                        
        Type:  defect                     |         Status:  new                        
    Priority:  Unspecified by Maintainer  |      Milestone:  Unspecified by Release Team
   Component:  Words                      |        Version:  Unspecified                
    Severity:  Unspecified                |       Keywords:  screenshot, 12.1.0         
Distribution:  Unspecified                |   Status_field:  Unconfirmed                
------------------------------------------+---------------------------------

Comment(by humitos):

 This is the [portion of code http://git.sugarlabs.org/words-activity
 /words-activity/blobs/master/LanguageModel.py#line29] that opens the
 files:
 {{{
 #!python
         with open(filename, 'r') as f:
             for line in f.readlines():
                 line = line.rstrip()
                 if line.startswith("#"):
                     continue

                 words_list = line.split('\t')
                 if words_list[0] in self.lang1_lang2:
                     self.lang1_lang2 [ words_list[0].lower() ] += ", " +
 words_list[-1].lower()
                 else:
                     self.lang1_lang2 [ words_list[0].lower() ] =
 words_list[-1].lower()

                 if words_list[-1] in self.lang2_lang1:
                     self.lang2_lang1 [ words_list[-1].lower() ] += ", " +
 words_list[0].lower()
                 else:
                     self.lang2_lang1 [ words_list[-1].lower() ]  =
 words_list[0].lower()
 }}}

 This code doesn't decode the content of the file. So, the encoding used
 it's the default encoding in the system: utf-8 in Sugar. So, I strongly
 suggest to convert those (all the .txt) files to UTF-8

-- 
Ticket URL: <http://bugs.sugarlabs.org/ticket/3571#comment:2>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list