[Koha] UTF 8 encoding

nitesh rijal rijal.it at gmail.com
Thu Nov 5 03:22:29 NZDT 2009


I have setup everything as the WIKI points. I got all the results
similar as well. My only problem is that the data stored in the
database is in encoded form and I need it displayed in decoded form
while searching the string.

The string in database looks like this:
"कारॠकी, यॠवराज सिंह"

The string I got from using an external utf8_decode() in a different PHP script.
"�?ार्�?�?, युवरा�? सि�?ह"

This is what I did.

CODE:
<?php
    $conn = mysql_connect('localhost','root','healthnet') or
die('Could not connect to database');
    $db = mysql_select_db('koha',$conn) or die('Could not select database');
    $query = mysql_query("SELECT author FROM biblio") or die('Could
not execute query');
    $row = mysql_fetch_array($query);
    echo '<pre>'.$row['author'].'</pre>';
    echo '<pre>'.utf8_decode($row['author']).'</pre>';
?>

Is there a problem with the search.pl script file???
I have set up the mysql character set as UTF8 and also the collation
in phpmyadmin is utf8_general_ci . Isn't this sufficient for the
Nepali Unicode???
Nepali is a Devnagari Script, similar to Hindi.


Please Help.


Thanks.

On 11/4/09, Chris Nighswonger <cnighswonger at foundations.edu> wrote:
> Hi Nitesh,
>
> On Wed, Nov 4, 2009 at 6:02 AM, nitesh rijal <rijal.it at gmail.com> wrote:
>> actually this is what  i got when i used UTF8_decode function of PHP
>>
>> CODE:
>> <?php
>>     $conn = mysql_connect('localhost','root','healthnet') or die('Could
>> not
>> connect to database');
>>     $db = mysql_select_db('koha',$conn) or die('Could not select
>> database');
>>     $query = mysql_query("SELECT author FROM biblio") or die('Could not
>> execute query');
>>     $row = mysql_fetch_array($query);
>>     echo '<pre>'.$row['author'].'</pre>';
>>     echo '<pre>'.utf8_decode($row['author']).'</pre>';
>> ?>
>>
>> Result:
>>
>> "कारॠकी, यॠवराज सिंह"
>>
>> "�?ार्�?�?, युवरा�? सि�?ह"
>>
>> Is there a problem with the search.pl script file???
>> I have set up the mysql character set as UTF8 and also the collation in
>> phpmyadmin is utf8_general_ci . Isn't this sufficient for the Nepali
>> Unicode???
>> Nepali is a Devnagari Script, similar to Hindi.
>
> I am not familiar with PHP.
>
> UTF8 setup is a bit tricky. As the wiki link points out, every
> component must be set to support UTF8. The OS, MySQL server, MySQL
> client, Apache, etc.
>
> There are many libraries in India using Koha successfully. Perhaps one
> of them could help you with getting things setup correctly.
>
> Kind Regards,
> Chris
>


-- 
Nitesh Rijal
BE IT
http://niteshrijal.com.np
+9779841458173


More information about the Koha mailing list