Carl Anatorian <anatoranato> wrote:
Do you mean the "MySQL Query Browser"?> I wrote a SQL script in MySQL Query,
Those two bytes are called BOM - byte order mark. This BOM is used to> and saved it as script.sql, but
> when I executed it in windows command line "mysql -h localhost -u root
> -ppassword -e "source script,sql" ", an error was shown ,which say I had
> a syntax error at the first line.I checked the script again and again,
> but no error was found ? What's wrong?At last ,I opened this script file
> in hex mode, and found two strange bytes at the beginning ---"0xFFFE". I
> removed it, and executed the script again. No Error, everything 's OK!
flag unicode files and to give a hint on the byte order in this file.
Seems pretty clear, that your ominous "MySQL Query" programm saves the> But who added these two bytes? I opened this file using MySQL Query
> again , and saved it ,then opened it using UltraEdit in hex mode , and
> I found the two bytes again.
query in unicode format. But then the MySQL monitor is not able to read
this unicode stuff.
I guess it's intended behaviour. You could try one of the following:> Who knows why MySQL Query adds "0xFFFE" at
> the script file's beginning ? Is this a bug?
1. look in the options of "MySQL Query" if you can change the encoding
for saved files from unicode to 8-bit (Windows-1250, latin-1 etc.)
2. add "--default-cht=utf8" to the mysql.exe command line, now
mysql should be able to read unicode
3. convert the saved files from unicode to latin-1 using an external
tool. Probably UltraEdit can do this.
Axel Schwenke, Senior Software Developer, MySQL AB
Online User Manual: [url]http://dev.mysql.com/doc/refman/5.0/en/[/url]
MySQL User Forums: [url]http://forums.mysql.com/[/url]