fix input according to locale rather perlio default#667
fix input according to locale rather perlio default#667jcarnu wants to merge 1 commit intodarold:masterfrom
Conversation
|
Thanks @jcarnu for the test to reproduce. Actually I would prefer to force the output to utf8 using: the test reports the right characters whatever is the locale: The problem with Then with your patch execute the test and you will have this output: now replace the pragma with :utf8 instead of :localeusing If you use my patch above that use binmod on all standard I/O , you will have the right output: I have noted the Illegal division by zero issue on tsung output. I can fix that but I'm not sure that the tsung output is used and maybe it can be removed to simplify the code. |
|
Hello Gilles, Thanks for your reply. My current follow-up is only to improve or broaden the discussion on input/output encodings. I agree I do not have your "users' experience feedback/background" so I was wondering on how things should work in case of "queries with others encoding not handled by UTF8" (Asian languages in particular). My point was to say : if we know there's a specific locale into logged queries, there should be a «nice» way to handle them through the OTOH we could think of a feature to force input encoding (not locale) like a specific switch... Thanks. |
If logs contains UTF-8 characters JSON output embeds "badly converted" characters :
This patch produces a correct query output with the given locale (locale should be adapted to input file locale) :
I didn't made extended tests on other output formats though it would be useful to be sure there won't be any regression.
Here are the simple tests I've made :
and outputs
It's quite basic (rough) but it shows up "Wide Character in print" warnings :
I'd like to get rid of such warning messages though could you give me more kind guidelines to finish this PR without warning (your thoughts). If not possible I'll try to find a correct way by myself.
Please take note of tsung output with illegal division by zero on line
where
$totalseems to be zero. Others output treats it like this(+$total||1)If this fix is correct, I'll include it in another PR.
Thanks for creating pgbadger, it's an everyday friend for me !