Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#3571 closed defect (fixed)

Encoding error in Spanish (at least)

Reported by: humitos Owned by: cjb
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: Words Version: Unspecified
Severity: Unspecified Keywords: screenshot, 12.1.0, patch
Cc: humitos Distribution/OS: Unspecified
Bug Status: Unconfirmed

Description

Steps to reproduce it:

  1. Open words activity
  2. Type "habit"

Issue:

The translated words are shown in the Translation Entry, but they are an incorrect encoding. It should be Unicode.

Expected behavior:

Show the translated words in the correct encoding.

Environment:

  • jhbuild in Fedora 16
  • git version of words-activiy

Attachments (4)

Captura pantalla de _Actividad Words_.png (31.9 KB) - added by humitos 12 years ago.
Spanish.txt.png (128.0 KB) - added by humitos 12 years ago.
File encoding is not properly set
Captura pantalla de _Actividad Palabras_.png (28.8 KB) - added by humitos 12 years ago.
Screenshot with the patch applied
0001-Recode-to-utf-8-Spanish-file-SL-3571.patch (47.0 KB) - added by humitos 12 years ago.

Download all attachments as: .zip

Change History (10)

Changed 12 years ago by humitos

comment:1 Changed 12 years ago by godiard

  • Keywords 12.1.0 added

Changed 12 years ago by humitos

File encoding is not properly set

comment:2 Changed 12 years ago 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:

        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

Changed 12 years ago by humitos

Screenshot with the patch applied

comment:3 Changed 12 years ago by humitos

  • Keywords patch added

comment:4 Changed 12 years ago by humitos

  • Resolution set to fixed
  • Status changed from new to closed

http://git.sugarlabs.org/words-activity/words-activity/commit/26a5017663bd195d7fe131b45ef587db737bac87

  • from the mailing list:

It introduces some whitespace errors and one typo in 'tachygraphical tquigráfica' but will be fixed on release.

comment:5 Changed 12 years ago by humitos

This will be fixed in version 17.

comment:6 Changed 12 years ago by RafaelOrtiz

Now in V17.

Note: See TracTickets for help on using tickets.