7 Aralık 2010 Salı

Yet Another Turkish Character Issue - MySQL Backup / Restore

mysqldump command is the mostly preferred way to backup a database (or a collection of databases). After restoring database from the dumped file you may encounter with distorted unicode characters.

Using UTF8 option while backing up and restoring database will prevent this problem.

So use following command to back the database :

mysqldump -u <user> -p  --default-character-set=utf8 <dbname> -r <dump_file>

and use following command to restore from dump file

mysql --default-character-set=utf8 -u <user> -p <dbname> -e "<dump_file>"

(yes fıle name is in quotes)








Liferay 6.0.5 Turkish Character Problem

You decided to upgrade your liferay portal application to version 6.0.5, worked hard and managed to migrate your custom implementation. You run brand new application and surprise. Turkish  portlet titles, Turkish labels in jsp ( you code these labels to get from properties files right? )  are all problematic. You tried to googling but nothing. At least, that was what happened to me.

Here is the recipe: Liferay is no more using ANSI encoded properties file. What you did for previous version was (what was recommended) writing your properties file in native language, saving it as UTF8 encoded. Let say you populated your properties file Language-ext_tr.properties.native. Later, liferay recommends generating Language-ext.properties file using native2ascii tool. This tool simply replaces non-ascii characters with corresponding unicode encoding. For example  character ı (i without a dot above) is converted to  \u0131.

Liferay 6.0.5 now reads properties files in UTF8 (without BOM), so no more you need to use native2ascii tool. Just rename your Language-ext_tr.properties.native as Language-ext_tr.properties, and leave the native characters as they are.