On my CentOS server, I have got a dump file of a mysql table which contains special czech characters in it (e.g. á, é, č, ž). When I view the file using cat, the special characters are broken (e.g. ĂĄ instead of á).
I need to correct those characters in the dump and then import it back to the database.
I have tried a few different ways already, but non of them worked, including:
- substitute the characters using sed with the following expression -
cat c_schools | sed 's/ĂĄ/á/g' > c_schools- but I get an
unterminated s commanderror,
- open the file in VIM and fix it manually, but VIM won't let me type the check characters,
- open the file in NANO and fix it manually, but NANO seems to be unable to work with the file at all (the text changes even as I move with the cursor).
As suggested in a comment, I opened the file in VIM again and try the following commands:
set encoding=utf-8(this one had no effect at all),
set termencoding=iso8859-2(the output is much better after this one but some characters are still incorrectly displayed, such as ? instead of č, ě or š),
When I copy the file to my Windows machine over FTP and open it in my standard text editor (Notepad++), it is displayed correctly and the encoding used is UTF-8, without BOM.