[Koha] Koha and utf8 suport [was: Re: Searching UTF-8 entries [Koha 3.01.00.002]]

H.S. hs.samix at gmail.com
Wed Oct 8 04:36:23 NZDT 2008


H.S. wrote:
> H. S. wrote:
>> In mysql that i have, I get this:
>>
>> mysql> SHOW VARIABLES LIKE 'character\_set\_%';
>> +--------------------------+--------+
>> | Variable_name            | Value  |
>> +--------------------------+--------+
>> | character_set_client     | latin1 |
>> | character_set_connection | latin1 |
>> | character_set_database   | latin1 |
>> | character_set_filesystem | binary |
>> | character_set_results    | latin1 |
>> | character_set_server     | latin1 |
>> | character_set_system     | utf8   |
>> +--------------------------+--------+
>> 7 rows in set (0.00 sec)
>>
>>
>> So even though my system is utf8, mysql databases are being created in
>> latin1. Is my understanding correct?
> 
> 
> Just found out that my koha database is in latin1 encoding:
> mysql> SHOW CREATE DATABASE koha;
> +----------+-----------------------------------------------------------------+
> | Database | Create Database
>      |
> +----------+-----------------------------------------------------------------+
> | koha     | CREATE DATABASE `koha` /*!40100 DEFAULT CHARACTER SET
> latin1 */ |
> +----------+-----------------------------------------------------------------+
> 1 row in set (0.00 sec)
> mysql>
> 
> 

So here is what I did. I made second installation of Koha for testing
purposes (on different ports, obiously) so that I could keep this test
installation separate from the original installation. The test
installation has mysql database named koha_test and its associated mysql
user and password.

Next, I dumped my original koha database (which I know is in latin1, see
above):
$> mysqldump  -uroot -p  --opt --default-character-set=latin1
--skip-set-charset koha > 20081006-koha-latin1.sql

Next, I restored the dump to the test installation:
$> mysql -uroot -pgsqdb514 koha_test < 20081006-koha-latin1.sql

And tried importing a book with ISBN 8173802130 from a Z39.50 search.
Since this test installation was a copy of the original, the result was
as before. The title is shown in Opac as is shown in this picture:
http://picasaweb.google.ca/hs.samix/Screenshots#5253043585127255666


Next, I tried to remake the test db supporting utf8. I converted my
original koha db dump to utf8.

$> iconv -f ISO-8859-1 -t UTF-8 20081006-koha-latin1.sql >
20081006-koha-utf8.sql
$> perl -pi -w -e 's/CHARSET=latin1/CHARSET=utf8/g;' 20081006-koha-utf8.sql


Then I dropped and recreated the test db supporting utf8:
$> mysql --user=root -p --execute="DROP DATABASE koha_test; CREATE
DATABASE koha_test CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
Enter password:
$>

And restored the utf8 db data:
$> mysql -uroot -p koha_test < 20081006-koha-utf8.sql
Enter password:
$>

At this point, the name of the library (the header in Opac page), which
was not in English, appears as a series of questions marks: ??????....

So, something is not gone right.

I then again searched and imported the book with ISBN 8173802130 and
added this item. Then searched for it in opac and get the title in the
same appearance as shown in the image linked earlier in this post.

Can somebody make out what I have missed above in creating this
koha_test db which supports utf8?

Thanks.





More information about the Koha mailing list