[Bug 19223] New: Problem with plugins and encodings
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Bug ID: 19223 Summary: Problem with plugins and encodings Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Staff Client Assignee: koha-bugs@lists.koha-community.org Reporter: magnus@libriotech.no QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com I have created a couple of plugins for Koha: https://github.com/Libriotech/koha-plugin-overview which queries the Koha database and reports things like number og biblio, items, patrons etc. https://github.com/Libriotech/koha-plugin-btj which receives data from an outside source, saves it to the database, creates records and items and displays some of the data to users. The second one does not show any encoding problems, but the first one does. When I look at /cgi-bin/koha/plugins/run.pl?class=Koha::Plugin::No::Libriotech::Overview&method=report&detail=items and have the language set to Norwegian, there are problems with the output from the plugin as well as the other parts of the page, such as the main menu at the very top of the page. I can't see that I have done anything very different in those two plugins, and yet they behave differently. Anyone got a clue if this is a problem with my code or with the plugin system? -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #1 from Magnus Enger <magnus@libriotech.no> --- Created attachment 68057 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=68057&action=edit Encoding problems around the EDS plugin The problem with encodings also shows up when the EDS API plugin is installed. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #2 from Magnus Enger <magnus@libriotech.no> --- Still a problem, with Koha 17.05.06.000 and version 17.11 of the EDS plugin. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de Severity|minor |major --- Comment #3 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Moving forward with plugins, I think we need to make sure that encodings are correctly handled. Upping severity. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #4 from Kyle M Hall <kyle@bywatersolutions.com> --- (In reply to Katrin Fischer from comment #3)
Moving forward with plugins, I think we need to make sure that encodings are correctly handled. Upping severity.
The crux of the matter is the question of the bug being in Koha's plugin system, or is it a bug in the plugin? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #5 from Magnus Enger <magnus@libriotech.no> --- (In reply to Kyle M Hall from comment #4)
The crux of the matter is the question of the bug being in Koha's plugin system, or is it a bug in the plugin?
I have seen it with more than one plugin. But those plugins might be based off each other (I know I have copied the KitchenSink plugin as a starter for my own plugins), so they might have the same bug... -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Maybe some best practice is needed or a fix, hard to tell - EDS plugin is hard to test, is there another we could take a look at more closely? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com --- Comment #7 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Katrin Fischer from comment #6)
Maybe some best practice is needed or a fix, hard to tell - EDS plugin is hard to test, is there another we could take a look at more closely?
When I put 'Tomás' in the author metadata for a plugin, it gets double-encoded in Koha. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #8 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Steps to reproduce: - Install some translation: $ kshell k$ cd misc/translator k$ perl translate install es-ES k$ exit $ restart_all - Enable es-ES in the sysprefs (languages) - Choose 'Español' - Upload a plugin (https://github.com/bywatersolutions/koha-plugin-csv2marc/releases) - Choose to configure the plugin => FAIL: Double-encoded chars on the header, everywhere actually. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #9 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Common practice is to have the plugins print their output, but it is not obvious that headers need to be generated correctly, etc. I will provide a patch that adds helper methods, and this needs to be highlighted in the KitchenSink plugin somehow. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #10 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 73348 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73348&action=edit Bug 19223: Unit tests for output and output_html methods -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 73349 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73349&action=edit Bug 19223: Add methods to correctly handle plugin-generated output This patch introduces two methods to be used by plugin authors: ->output ->output_html They are basically wrappers for the helper methods from C4::Output (output_html_with_http_headers and output_with_http_headers). Plugin authors can use them, or keep the current flexibility of handling the headers themselves in their code. The KitchenSink plugin should be updated to highlight this. To test: - Run: $ kshell k$ prove t/db_dependent/Plugins.t => FAIL: The methods are not implemented - Apply this patch - Run: k$ prove t/db_dependent/Plugins.t => SUCCESS: Tests pass, and they are meaningful - Sign off :-D Sponsored-by: ByWater Solutions -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |contact@alvet.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Problem with plugins and |Help plugin authors output |encodings |headers correctly Text to go in the| |The current plugin writing release notes| |practice is to craft the | |response header in the | |controller methods. This | |patchset adds new helper | |methods for plugin authors | |to use when dealing with | |output on their plugins. | |This way the end-user | |experience is better, and | |the plugin author's tasks | |easier. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #12 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Hi Tomas, can you submit a pull request to the kitchen sink plugin to make this easy to test? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73348|0 |1 is obsolete| | Attachment #73349|0 |1 is obsolete| | --- Comment #13 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 73512 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73512&action=edit Bug 19223: Unit tests for output and output_html methods Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #14 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 73513 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73513&action=edit Bug 19223: Add methods to correctly handle plugin-generated output This patch introduces two methods to be used by plugin authors: ->output ->output_html They are basically wrappers for the helper methods from C4::Output (output_html_with_http_headers and output_with_http_headers). Plugin authors can use them, or keep the current flexibility of handling the headers themselves in their code. The KitchenSink plugin should be updated to highlight this. To test: - Run: $ kshell k$ prove t/db_dependent/Plugins.t => FAIL: The methods are not implemented - Apply this patch - Run: k$ prove t/db_dependent/Plugins.t => SUCCESS: Tests pass, and they are meaningful - Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #15 from Kyle M Hall <kyle@bywatersolutions.com> --- https://github.com/bywatersolutions/koha-plugin-kitchen-sink/commit/b975bb9b... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73512|0 |1 is obsolete| | Attachment #73513|0 |1 is obsolete| | --- Comment #16 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 73589 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73589&action=edit Bug 19223: Unit tests for output and output_html methods Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 --- Comment #17 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 73590 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73590&action=edit Bug 19223: Add methods to correctly handle plugin-generated output This patch introduces two methods to be used by plugin authors: ->output ->output_html They are basically wrappers for the helper methods from C4::Output (output_html_with_http_headers and output_with_http_headers). Plugin authors can use them, or keep the current flexibility of handling the headers themselves in their code. The KitchenSink plugin should be updated to highlight this. To test: - Run: $ kshell k$ prove t/db_dependent/Plugins.t => FAIL: The methods are not implemented - Apply this patch - Run: k$ prove t/db_dependent/Plugins.t => SUCCESS: Tests pass, and they are meaningful - Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |kyle@bywatersolutions.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Help plugin authors output |Plugin authors does not |headers correctly |output headers correctly CC| |jonathan.druart@bugs.koha-c | |ommunity.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Plugin authors does not |Add helper methods to |output headers correctly |plugins to output headers | |correctly -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #18 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 18.05, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Add helper methods to |Avoid encoding issues in |plugins to output headers |plugins by providing helper |correctly |methods to output headers | |correctly -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |nick@bywatersolutions.com --- Comment #19 from Nick Clemens <nick@bywatersolutions.com> --- Pushed to stable for 17.11.06 Awesome work all! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #20 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Is this for 17.05.x also ? t/db_dependent/Plugins.t is actually OK -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19223 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Pushed to Stable |RESOLVED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org