Ticket #3571 (closed defect: fixed)

Opened 13 months ago

Last modified 12 months ago

Encoding error in Spanish (at least)

Reported by: humitos Owned by: cjb
Priority: Unspecified by Maintainer Milestone: Unspecified by Release Team
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

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

Change History

Changed 13 months ago by humitos

Changed 13 months ago by godiard

  • keywords screenshot, 12.1.0 added; screenshot removed

Changed 12 months ago by humitos

File encoding is not properly set

Changed 12 months 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 months ago by humitos

Screenshot with the patch applied

Changed 12 months ago by humitos

Changed 12 months ago by humitos

  • keywords 12.1.0, patch added; 12.1.0 removed

Changed 12 months ago by humitos

  • status changed from new to closed
  • resolution set to fixed

 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.

Changed 12 months ago by humitos

This will be fixed in version 17.

Changed 12 months ago by RafaelOrtiz

Now in V17.

Note: See TracTickets for help on using tickets.