We need to revert small change in C4/Templates.pm
Created attachment 17527 [details] [review] Bug 10074 - Revert small change in C4/Templates.pm One of this bug's patches removed the addition of BOM from the templates by setting ENCODING=>'utf8'. This change was found to be the cause of several random problems with encodings. This patch reverts it. Regards To+
To test: - Install the es-ES translations - Load the login page on the staff site - "Contraseña" (for password) looks broken - Apply the patch and reload - The word in not broken anymore.
Created attachment 17528 [details] [review] Bug 10074 - Encoding problems in templates Bug 6554 patched output_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded. (At least) the staff login screen outputs directly to STDOUT (Auth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first. This patch adds the encode step (using Encode::encode) and that's it. Regards To+ Sponsored-by: Universidad Nacional de Córdoba
Created attachment 17529 [details] [review] [SIGNED-OFF] Bug 10074 - Encoding problems in templates Bug 6554 patched output_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded. (At least) the staff login screen outputs directly to STDOUT (Auth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first. This patch adds the encode step (using Encode::encode) and that's it. Regards To+ Sponsored-by: Universidad Nacional de Córdoba Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Small patch, fixes annoying error. No koha-qa errors.
Created attachment 17530 [details] [review] Bug 10074 - Encoding problems in templates Bug 6554 patched output_html_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded. (At least) the staff login screen outputs directly to STDOUT (Auth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first. This patch makes it use output_html_with_http_headers and solves the problem. Regards To+ Sponsored-by: Universidad Nacional de Córdoba
After talking with Jared on IRC, we concluded this was the best short-term solution. On the mid/long-term we should move output somewhere else.
Created attachment 17531 [details] [review] Bug 10074 - Encoding problems in templates (installer/InstallAuth.pm) Bug 6554 patched output_html_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded. The Installer page login screen outputs directly to STDOUT (InstallAuthAuth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first. This patch makes it use output_html_with_http_headers and solves the problem. Regards To+
Created attachment 17532 [details] [review] Bug 10074 - Encoding problems in templates (installer/InstallAuth.pm) Bug 6554 patched output_html_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded. The Installer page login screen outputs directly to STDOUT (InstallAuthAuth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first. This patch makes it use output_html_with_http_headers and solves the problem. Regards To+ Sponsored-by: Universidad Nacional de Córdoba
This looks good to me. Will try to sign it off if no one else beats me to it. Note that the problem actually is related to a print statement while stdout is not set to utf-8. I corrected a similar situation somewhere in Koha with a use open statement to utf-8.
(In reply to comment #9) > This looks good to me. Will try to sign it off if no one else beats me to > it. Note that the problem actually is related to a print statement while > stdout is not set to utf-8. I corrected a similar situation somewhere in > Koha with a use open statement to utf-8. That's correct. The only lib that should be printing to stdout should be C4::Output anyway.
Created attachment 17533 [details] [review] [SIGNED-OFF] Bug 10074 - Encoding problems in templates Bug 6554 patched output_html_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded. (At least) the staff login screen outputs directly to STDOUT (Auth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first. This patch makes it use output_html_with_http_headers and solves the problem. Regards To+ Sponsored-by: Universidad Nacional de Córdoba Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Created attachment 17534 [details] [review] [SIGNED-OFF] Bug 10074 - Encoding problems in templates (installer/InstallAuth.pm) Bug 6554 patched output_html_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded. The Installer page login screen outputs directly to STDOUT (InstallAuthAuth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first. This patch makes it use output_html_with_http_headers and solves the problem. Regards To+ Sponsored-by: Universidad Nacional de Córdoba Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tomas, I am wondering if you should "Use" the Output module in Auth.pm. You only need the module if the login fails. So you could require it at that moment in run-time (without the additional import when using a file). The use statement will always require Output at compile-time. So in terms of performance it would be better to require. In other words, what about this in C4/Auth.pm: require C4::Output; C4::Output::output_html_with_http_headers( $query, $cookie, $template->output); What do you think?
Created attachment 17542 [details] [review] Bug 10074 - Encoding problems in templates Bug 6554 patched output_html_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded. (At least) the staff login screen outputs directly to STDOUT (Auth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first. This patch makes it use output_html_with_http_headers and solves the problem. Changed 'use' for 'require' as jcamins and marcelr suggested. Regards To+ Sponsored-by: Universidad Nacional de Córdoba
Created attachment 17545 [details] [review] [SIGNED-OFF] Bug 10074 - Encoding problems in templates Bug 6554 patched output_html_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded. (At least) the staff login screen outputs directly to STDOUT (Auth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first. This patch makes it use output_html_with_http_headers and solves the problem. Changed 'use' for 'require' as jcamins and marcelr suggested. Regards To+ Sponsored-by: Universidad Nacional de Córdoba Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Created attachment 17546 [details] [review] Bug 10074 - Encoding problems in templates (installer/InstallAuth.pm) Bug 6554 patched output_html_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded. The Installer page login screen outputs directly to STDOUT (InstallAuthAuth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first. This patch makes it use output_html_with_http_headers and solves the problem. Regards To+ Sponsored-by: Universidad Nacional de Córdoba Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment on attachment 17546 [details] [review] Bug 10074 - Encoding problems in templates (installer/InstallAuth.pm) Trouble with utf8 on git itself..
Created attachment 17548 [details] [review] Bug 10074 - Encoding problems at login time Bug 6554 patched output_html_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded. (At least) the staff login screen outputs directly to STDOUT (Auth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first. This patch makes it use output_html_with_http_headers and solves the problem. Changed 'use' for 'require' as jcamins and marcelr suggested. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 17549 [details] [review] Bug 10074 - Encoding problems for installer Bug 6554 patched output_html_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded. The Installer page login screen outputs directly to STDOUT (InstallAuthAuth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first. This patch makes it use output_html_with_http_headers and solves the problem. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 17550 [details] [review] Bug 10074: QA Followup for InstallAuth.pm Moving use Output.pm to optional require. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
QA Comment: Good catch, Tomas. Moved your second use to a require too in InstallAuth.pm. Improving code by using output routine in module instead of printing directly to stdout without taking care of proper encoding. This does not revert the change in Templates.pm btw, but corrects encoding for login and installer template. Note that a separate encode statement could have done the job too, but this is even better. Passed QA
Tomas: I had problems with Córdoba. Has to do with the git version.
This patch has been pushed to master and 3.12.x.
Reverted. Closing this report.