Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/mysqld_multi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ sub w2log

open (LOGFILE, ">>$opt_log")
or die "FATAL: w2log: Couldn't open log file: $opt_log\n";

binmode(LOGFILE, ":encoding(UTF-8)");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to be enough. If locale is set to something non-utf8, perl binmode will screw up the string:

LC_TIME="zh_CN.GB18030" perl -e 'use POSIX qw(strftime); open (LOGFILE, ">>log"); binmode(LOGFILE, ":encoding(UTF-8)"); print LOGFILE strftime "%a %b %e %H:%M:%S %Y\n", localtime; close(LOGFILE);'
iconv -f gb18030 -t utf8 < log

This simplest solution would be to change date format such that it doesn't contain non-ASCII characters, e.g %Y-%m-%d %H:%M:%S. Another option is to preserve date format, but use something else instead of strftime() like Time::Piece or DateTime.

if ($is_file)
{
open (FROMFILE, "<$msg") && (@data=<FROMFILE>) &&
Expand Down