campsych / concerto-platform

Concerto Platform - Open-Source Online Adaptive Testing Platform
https://concertoplatform.com/
Apache License 2.0
153 stars 88 forks source link

UTF8 issues when using external sql databases #294

Open csancineto opened 4 years ago

csancineto commented 4 years ago

Concerto Platform version

5.0.13

Expected behavior

Text using unicode to be shown correctly

Actual behavior

Accented texts are displayed incorrectly. The templates are in UTF-8 but they are shown in a different codification.

Steps to reproduce the issue

I'm using Concerto installed in my University's server. When I use the internal container databases, the test is presented correctly. When I use external sql databases (to improve the performance), all the texts are presented incorrectly when I run the tests. When the templates are opened internally, all the texts are in UTF-8; when presented, the same templates are corrupt.

A simple test that shows the problem is in the following link: https://concerto.sites.ufsc.br/test/teste

Captura de Tela 2020-07-21 às 17 18 51 Captura de Tela 2020-07-21 às 17 18 39
bkielczewski commented 4 years ago

Hi.

Is your Concerto installation on University's server a bare-metal installation, not using the container we provide?

If so, this would look like the operating system doesn't have en_US.UTF8 locale enabled. R interpreter needs this to handle UTF-8 properly in the strings. It is used when you run the test and isn't involved when you just use the admin panel. This would explain why you see the text correctly there but not when running the test.

To address this on the server Concerto is running on add this line to /etc/locale.gen:

en_US.UTF-8 UTF-8

Then execute:

locale-gen "en_US.UTF-8"

Best, b.

csancineto commented 4 years ago

Thank you very much. I forwarded your answer to the professional responsible for installing the Concert. As soon as I get a return from him, I'll indicate if it worked.

josenorberto commented 4 years ago

Hi!

I was in contact with @csancineto to address this issue. I made a pull request (https://github.com/campsych/concerto-platform/pull/295) with the solution to the encoding problem we were facing with our University's MySQL server.

Best regards, José Norberto Guiz Fernandes Corrêa