mojolicious / minion

:octopus: Perl high performance job queue
https://metacpan.org/release/Minion
Artistic License 2.0
221 stars 55 forks source link

encode UTF-8 YAML::XS::Dump #126

Open s1037989 opened 1 year ago

s1037989 commented 1 year ago

Summary

encode UTF-8 YAML::XS::Dump in Minion Admin list jobs

Motivation

Is this an appropriate thing to do? I have notes with utf8 and they don't show up right in the Admin page, but adding this make it show up right. Is there another way to get the notes to render UTF-8 correctly?

rabbiveesh commented 1 year ago

Officially, JSON is supposed to always be UTF-8, but at least for postgres, the json is practically stored in DB encoding. I would imagine that this patch is sane, nonetheless

kraih commented 1 year ago

I think _dump is used in multiple places and one of them probably prints to a terminal, where this would break unicode.

s1037989 commented 1 year ago

Would it be an acceptable patch to add this function alphabetically?

sub _decoded_dump { Mojo::Util::decode 'UTF-8', _dump(@_) }

And then on L158 of jobs.html.ep:

<pre class="border rounded"><%= Minion::_decoded_dump(Minion::_datetime($job)) %></pre>