[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Artanis] database with Japanese text not displaying properly
From: |
Nala Ginrut |
Subject: |
Re: [Artanis] database with Japanese text not displaying properly |
Date: |
Sat, 23 Jun 2018 03:08:22 +0800 |
User-agent: |
mu4e 1.1.0; emacs 25.1.1 |
Hmm...I've taken a glance at "set names", it's DB specific
things so that Artanis can't provide an unify solution for users.
MariaDB/postgresql support "set names", but sqlite3 doesn't. It's still
possible to support new databases in the future. So maybe the hook is
enough for users.
Nala Ginrut writes:
> Hi Julio!
>
> Julio Claudio Matus Ramirez writes:
>
>> Hello Nala Ginrut,
>> <% (DB-query conn "set names utf8") %>
>>
>> (adding this before calling the database query in the viewer)
>
> This should be configurable in Artanis, I will consider how to do it
> properly. The idea is that users shouldn't consider these stuff by themselves.
> Thanks for point it out!
>
>> It's the only way I could find to change the encoding for the client
>> output. If you have any other solution/suggestion I'm very interested.
>>
>> It would be great if we could add random connection initilization raw
>> strings/options as with other frameworks. Being able to call random sql
>> code would be nice too (I'm guessing you didn't intend DB-query to be
>> used in this way).
>
> I've added a hook which should be triggered each time when DB is
> initializing, it's named run-when-DB-init in (artanis utils). And you
> should add your hook in ENTRY file:
>
> --------------------ENTRY--------------------
> (use-modules (artanis utils) (artanis artanis))
> (run-when-DB-init
> (lambda (conn)
> (DB-query conn "set names utf8")))
>
> (init-server) ; make sure the hook is registered before (init-server)
> ...
> --------------------end---------------------
>
> This will effect all pre-connected connections in conn-pool
> automatically.
>
> The commit is here:
> https://gitlab.com/NalaGinrut/artanis/commit/1ae23e773f48d112c3a006ad214eec8a92686074
>
> Could you try and feedback?
> Thanks!
--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058
signature.asc
Description: PGP signature