Answer Question
MySQL command line import of file with UTF-8 encoding.
I am having trouble with an .sql file containing a backup of a database which will be used to restore the database daily.
The way I am executing the restore process is by using the mysql command (batch mode - linux shell):
mysql < origdata.sql
This works perfectly if the .sql file itself is encoded with default (ISO-????) character set, but when working with more exotic languages I have to use UTF-8. Saving the file in UTF-8 encoding is not working, since mysql doesn't know that it is UTF-8 and interprets it as default encoding, thus messing up a lot of forreign characters.
My question is, if there is a way to let mysql know that this file should be interpreted as UTF-8?
Either by
1) specifying the encoding on the command line
2) specifying the encoding within the file
3) specifying the encoding at filesystem level (I am not so clear here, but something like headers for http)
Note that this problem has nothing to do with the charset or collation of the database itself, nor with the database connection (these all work perfectly with UTF-8) only the command line import utility.
Please come forward if you know anything about this!
Jakob
TEXT
Uploading file and scanning for virus...
Please Wait