From d0b076b66cef0335a884fa96c1c636bbef31a9db Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Oct 2007 13:06:01 +0500 Subject: Bug#29323 mysql client only accetps ANSI encoded files Fix: ignore BOM marker in the first line. client/mysql.cc: Skip BOM marker in the very first line. mysql-test/r/mysql.result: Adding test mysql-test/t/mysql.test: Adding test --- client/mysql.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'client/mysql.cc') diff --git a/client/mysql.cc b/client/mysql.cc index 8e1b6c2a9b4..3cc7f2ad090 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1042,6 +1042,17 @@ static int read_and_execute(bool interactive) if (!interactive) { line=batch_readline(status.line_buff); + /* + Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF. + Editors like "notepad" put this marker in + the very beginning of a text file when + you save the file using "Unicode UTF-8" format. + */ + if (!line_number && + (uchar) line[0] == 0xEF && + (uchar) line[1] == 0xBB && + (uchar) line[2] == 0xBF) + line+= 3; line_number++; if (!glob_buffer.length()) status.query_start_line=line_number; -- cgit v1.2.1