utf8 is a : go for beta test in HEAD.
authortipaul <tipaul>
Wed, 4 Jan 2006 15:54:55 +0000 (15:54 +0000)
committertipaul <tipaul>
Wed, 4 Jan 2006 15:54:55 +0000 (15:54 +0000)
some explanations :
- updater/updatedatabase => will transform all tables in innoDB (not related to utf8, just to warn you) AND collate them in utf8 / utf8_general_ci. The SQL command is : ALTER TABLE tablename DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci.
- *-top.inc will show the pages in utf8
- THE HARD THING : for me, mysql-client and mysql-server were set up to communicate in iso8859-1, whatever the mysql collation ! Thus, pages were improperly shown, as datas were transmitted in iso8859-1 format ! After a full day of investigation, someone on usenet pointed "set NAMES 'utf8'" to explain that I wanted utf8. I could put this in my.cnf, but if I do that, ALL databases will "speak" in utf8, that's not what we want. Thus, I added a line in Context.pm : everytime a DB handle is opened, the communication is set to utf8.
- using marcxml field and no more the iso2709 raw marc biblioitems.marc field.

21 files changed:
C4/Biblio.pm
C4/Context.pm
koha-tmpl/intranet-tmpl/default/en/includes/about-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/acquisitions-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/auth-search-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/auth-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/bull-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/cat-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/circulation-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/error-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/help-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/marc-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/members-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/neutral-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/opac-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/parameters-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/popup-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/quicksearch-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/reports-top.inc
koha-tmpl/intranet-tmpl/default/en/includes/reportswcal-top.inc
updater/updatedatabase

index a3da03b..7f5c3a0 100644 (file)
@@ -277,10 +277,10 @@ sub MARCgetbiblio {
 
     # Returns MARC::Record of the biblio passed in parameter.
     my ( $dbh, $biblionumber ) = @_;
-       my $sth = $dbh->prepare('select marc from biblioitems where biblionumber=?');
+       my $sth = $dbh->prepare('select marcxml from biblioitems where biblionumber=?');
        $sth->execute($biblionumber);
        my ($marc) = $sth->fetchrow;
-       my $record = MARC::File::USMARC::decode($marc);
+       my $record = MARC::Record::new_from_xml($marc);
     return $record;
 }
 
@@ -2884,6 +2884,14 @@ Paul POULAIN paul.poulain@free.fr
 
 # $Id$
 # $Log$
+# Revision 1.134  2006/01/04 15:54:55  tipaul
+# utf8 is a : go for beta test in HEAD.
+# some explanations :
+# - updater/updatedatabase => will transform all tables in innoDB (not related to utf8, just to warn you) AND collate them in utf8 / utf8_general_ci. The SQL command is : ALTER TABLE tablename DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci.
+# - *-top.inc will show the pages in utf8
+# - THE HARD THING : for me, mysql-client and mysql-server were set up to communicate in iso8859-1, whatever the mysql collation ! Thus, pages were improperly shown, as datas were transmitted in iso8859-1 format ! After a full day of investigation, someone on usenet pointed "set NAMES 'utf8'" to explain that I wanted utf8. I could put this in my.cnf, but if I do that, ALL databases will "speak" in utf8, that's not what we want. Thus, I added a line in Context.pm : everytime a DB handle is opened, the communication is set to utf8.
+# - using marcxml field and no more the iso2709 raw marc biblioitems.marc field.
+#
 # Revision 1.133  2005/12/12 14:25:51  thd
 #
 #
index f270d26..9c82561 100644 (file)
@@ -408,8 +408,12 @@ sub _new_dbh
        my $db_host   = $context->{"config"}{"hostname"};
        my $db_user   = $context->{"config"}{"user"};
        my $db_passwd = $context->{"config"}{"pass"};
-       return DBI->connect("DBI:$db_driver:$db_name:$db_host",
+       my $dbh= DBI->connect("DBI:$db_driver:$db_name:$db_host",
                            $db_user, $db_passwd);
+       # Koha 3.0 is utf-8, so force utf8 communication between mySQL and koha, whatever the mysql default config.
+       # this is better than modifying my.cnf (and forcing all communications to be in utf8)
+       $dbh->do("set NAMES 'utf8'");
+       return $dbh;
 }
 
 =item dbh
index 5db9f8a..77daa12 100644 (file)
@@ -4,7 +4,7 @@
 <head>
 <title>KOHA: INTRANET: About</title>
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/common-style.css">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 <script language="JavaScript" type="text/javascript">
 function Help() {
        newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');
index f450663..bdf0a9c 100644 (file)
@@ -15,7 +15,7 @@
 </script>
 <!-- /Additions for Calendar-system -->
 
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 <script language="JavaScript" type="text/javascript">
 function Help() {
        newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');
index 70dc1c0..ab95e76 100644 (file)
@@ -3,7 +3,7 @@
 <html>
 <head>
 <title>KOHA: INTRANET: Authorities</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 
 <script language="JavaScript">
 <!-- Hide from old browsers
index de6b538..16b2472 100644 (file)
@@ -3,7 +3,7 @@
 <html>
 <head>
 <title>KOHA: INTRANET: Authorities</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 
 <script language="JavaScript">
 <!-- Hide from old browsers
index bfced7f..6b59e00 100644 (file)
@@ -4,7 +4,7 @@
 <head>
 <title>KOHA: INTRANET: Serials management</title>
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/common-style.css">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 <script language="JavaScript" type="text/javascript">
 function Help() {
        newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');
index 630fc1b..2f492fa 100644 (file)
@@ -2,7 +2,7 @@
 <html>
 <head>
 <title>KOHA: INTRANET: Catalogue</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 
 <script language="JavaScript" type="text/javascript">
 <!-- Hide from old browsers
index 11cdfd3..a4ae086 100644 (file)
@@ -3,7 +3,7 @@
 <html>
 <head>
 <title>KOHA: INTRANET: Circulation</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 
 <script language="JavaScript">
 <!-- Hide from old browsers
index 9bd31cb..477b192 100644 (file)
@@ -3,7 +3,7 @@
 <html>
 <head>
 <title>KOHA: INTRANET: Catalogue</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 
 <script language="JavaScript">
 <!-- Hide from old browsers
index 5d5ea9a..043b596 100644 (file)
@@ -3,7 +3,7 @@
 <html>
 <head>
 <title>KOHA: online help</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/common-style.css">
 <body>
index 608c64d..53c1a47 100644 (file)
@@ -3,7 +3,7 @@
 <html>
 <head>
 <title>KOHA: INTRANET: Catalogue</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 
 <script language="JavaScript" type="text/javascript">
 <!-- Hide from old browsers
index e8519ab..1ee12c9 100644 (file)
@@ -4,7 +4,7 @@
 <head>
 <title>KOHA: INTRANET: Members</title>
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/common-style.css">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 <script language="JavaScript" type="text/javascript">
 function Help() {
        newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');
index c023373..9def47a 100644 (file)
@@ -3,7 +3,7 @@
 <html>
 <head>
 <title>KOHA: INTRANET: Catalogue</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 
 <script language="JavaScript">
 <!-- Hide from old browsers
index 23df616..2a9210c 100644 (file)
@@ -4,7 +4,7 @@
 <html>
 <head>
 <title>KOHA: OPAC Catalogue Search</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 
 </head>
 <body text="black" bgcolor="white" link="#0000ff" vlink="#3366cc" Alink="#cc3300"
index 81c8198..c6187b9 100644 (file)
@@ -7,7 +7,7 @@
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar-system.css">
 <!-- End of additions -->
 
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 <!-- Additions to enable Calendar system -->
 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar.js"></script>
 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar-en.js"></script>
index c672e24..bf72fe2 100644 (file)
@@ -3,7 +3,7 @@
 <html>
 <head>
 <title>popup</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/common-style.css">
 
index b0cfb2a..5b3ae8d 100644 (file)
@@ -3,7 +3,7 @@
 <html>
 <head>
 <title>popup</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/common-style.css">
 <script language="javascript" type="text/javascript">
index a620c71..1da06ad 100644 (file)
@@ -4,7 +4,7 @@
 <head>
 <title>KOHA: INTRANET: Reports</title>
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/common-style.css">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 <script language="JavaScript" type="text/javascript">
 function Help() {
        newin=window.open("/cgi-bin/koha/help.pl","Koha Help",'width=600,height=600,toolbar=false,scrollbars=yes');
index f08ed35..990da22 100755 (executable)
@@ -8,7 +8,7 @@
 <!-- End of additions -->
 <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" -->/includes/common-style.css">
 
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta http-equiv="Content-Type" content="text/html; charset=utf8">
 <!-- Additions to enable Calendar system -->
 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar.js"></script>
 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/includes/calendar/calendar-en.js"></script>
index c6e0fd9..48c7d5a 100755 (executable)
@@ -545,6 +545,22 @@ unless ($marcdone) {
        print "\rdone\n";
 }
 
+# MOVE all tables TO UTF-8 and innoDB
+$sth = $dbh->prepare("show table status");
+$sth->execute;
+while ( my $table = $sth->fetchrow_hashref ) {
+       if ($table->{Engine} ne 'InnoDB') {
+               $dbh->do("ALTER TABLE $table->{Name} TYPE = innodb");
+               print "moving $table->{Name} to InnoDB\n";
+       }
+       unless ($table->{Collation} =~ /^utf8/) {
+               $dbh->do("ALTER TABLE $table->{Name} DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci");
+               # FIXME : maybe a ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8 would be better, def char set seems to work fine. If any problem encountered, let's try with convert !
+               print "moving $table->{Name} to utf8\n";
+       } else {
+       }
+}
+
 # at last, remove useless fields
 foreach $table ( keys %uselessfields ) {
        my @fields = split /,/,$uselessfields{$table};
@@ -737,6 +753,14 @@ sub MARCgetitem {
 exit;
 
 # $Log$
+# Revision 1.125  2006/01/04 15:54:55  tipaul
+# utf8 is a : go for beta test in HEAD.
+# some explanations :
+# - updater/updatedatabase => will transform all tables in innoDB (not related to utf8, just to warn you) AND collate them in utf8 / utf8_general_ci. The SQL command is : ALTER TABLE tablename DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci.
+# - *-top.inc will show the pages in utf8
+# - THE HARD THING : for me, mysql-client and mysql-server were set up to communicate in iso8859-1, whatever the mysql collation ! Thus, pages were improperly shown, as datas were transmitted in iso8859-1 format ! After a full day of investigation, someone on usenet pointed "set NAMES 'utf8'" to explain that I wanted utf8. I could put this in my.cnf, but if I do that, ALL databases will "speak" in utf8, that's not what we want. Thus, I added a line in Context.pm : everytime a DB handle is opened, the communication is set to utf8.
+# - using marcxml field and no more the iso2709 raw marc biblioitems.marc field.
+#
 # Revision 1.124  2005/10/27 12:09:05  tipaul
 # new features for serial module :
 # - the last 5 issues are now shown, and their status can be changed (but not reverted to "waited", as there can be only one "waited")