Hi all, I don't know whether this is a Konqueror problem or a Koha flaw...but each time I access this page http://localhost:8080/cgi-bin/koha/members-home.pl Konqueror reverses to iso-8859-1 and polish characters get scrambled. I tried to insert <meta http-equiv=...> tag but to no avail. Isn't there a perl script in Koha that inforces iso-8859-1 everywhere in the "output"? regards, Benedict
Hi, In article <E18XXdh-0003An-00@sc8-sf-list1.sourceforge.net>, Benedict <kb2qzv@poczta.wp.pl> wrote:
I don't know whether this is a Konqueror problem or a Koha flaw...but each time I access this page http://localhost:8080/cgi-bin/koha/members-home.pl Konqueror reverses to iso-8859-1 and polish characters get scrambled. I tried to insert <meta http-equiv=...> tag but to no avail.
I have found the culprit of the problem; it is neither Konquerer nor Koha. It is CGI.pm. It seems that CGI.pm has the bad habit of assuming that everything is in ISO-8859-1 unless we explictly override it. (Passing it -type => 'text/html' is not enough; it will still output 'Content-Type: text/html; charset=ISO-8859-1'.) The following patch demonstrates the problem: -------------- cut here ------------ 8< ------------------------- --- mainpage.pl.dist Sun Jan 12 22:51:22 2003 +++ mainpage.pl Sun Jan 12 23:16:28 2003 @@ -17,4 +17,15 @@ debug => 1, }); -print $query->header(-cookie => $cookie), $template->output; +# CGI.pm assumes that everything is in ISO-8859-1 unless overridden +# This breaks non-Latin1 languages such as Polish and Chinese +# We *must* guess the correct charset and explictly override it + +my $output = $template->output; +my $charset = $1 if /<meta\s+http-equiv=(["']?)Content-Type\1\s+content=(["'])text\/html;\s*charset=[^\2]\2>/is; +my $type = defined $charset? 'text/html': "text/html; charset=$1"; + +print $query->header( + -type => $type, + -cookie => $cookie, +), $output; -------------- cut here ------------ 8< ------------------------- After applying this patch, the login screen is still forced into ISO-8859-1, but after logging in, the main screen will be correctly displayed in ISO-8859-2. Of course, this only fixes one page :-( I suppose the "easiest" option for us is to create a new function somewhere in C4 to do the above, and no other Koha code should call CGI.pm's "header" method. We will need to find out where the "header" method is being called, and change every function call to use the new function that will be written. -- Ambrose Li <a.c.li@ieee.org> http://ada.dhs.org/~acli/cmcc/ http://www.cccgt.org/ DRM is theft - We are the stakeholders
Sorry, obviously I should not write email at 23xx. I left out the other half of the demonstration. It is the following: ------------- cut here ----------- 8< ----------------------- --- intranet-main.tmpl.dist Sun Jan 12 22:51:22 2003 +++ intranet-main.tmpl Sun Jan 12 22:58:08 2003 @@ -1,5 +1,7 @@ <HTML> <TITLE>WITAMY W INTRANECIE KOHA </TITLE> +<meta http-equiv="Content-Language" content="pl"> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"> <style type="text/css"> ------------- cut here ----------- 8< ----------------------- Regarding the demonstration, I probably should point out that the regular expression shown in the previous email is not optimal; it will miss some valid META tags. When the solution is written, the regular expression must not be just taken out from the demonstration. -- Ambrose Li <a.c.li@ieee.org> http://ada.dhs.org/~acli/cmcc/ http://www.cccgt.org/ DRM is theft - We are the stakeholders
Hi, Benedict, do you want to start adding the meta tags to the Polish files? I am in the process of making the scripts iso-8859-2-aware (and Big5-aware). BTW, the correct syntax for the meta tag should be <meta http-equiv="Content-Type" content="text/html; charset=iso8859-2"> (You can leave out the quotes in "http-equiv", but the "content" must be quoted.) -- Ambrose Li <a.c.li@ieee.org>
Użytkownik "acli@ada.dhs.org via news-to-mail gateway" <news-misc@ada.dhs.org> napisał w wiadomości news:H8zJ3r.FvH@ada.dhs.org...
Hi, Benedict,
do you want to start adding the meta tags to the Polish files? I am in the process of making the scripts iso-8859-2-aware (and Big5-aware).
BTW, the correct syntax for the meta tag should be
<meta http-equiv="Content-Type" content="text/html; charset=iso8859-2">
(You can leave out the quotes in "http-equiv", but the "content" must be quoted.)
I am waiting for the programmers of Koha to make their move. This week I am going to upgrade to Redhat 8.0. I heard from a friend of mine that thay (at RedHat) have switched to UTF-8 in the whole distribution. Will it influence my translation? If so, the whole transition will be put on hold on my part. I don't know how to force an iso-8859-2 charset in editors on a UTF-8 aware redhat system !!! Benedict PS. During the upgrade the third redhat cd3 disk was corrupted so I do not have a working linux system at the moment:-) I hope sf.net's got hold of the koha cvs tree, HI HI.
On Mon, Jan 20, 2003 at 01:10:25AM +0100, Benedykt P. Barszcz wrote:
I don't know how to force an iso-8859-2 charset in editors on a UTF-8 aware redhat system !!!
Presumably with: M-: (setq buffer-file-coding-system 'iso-8859-2) -- Andrew Arensburger This message *does* represent the arensb@ooblick.com views of ooblick.com Nobody has ever, EVER learned all of Emacs.
And this line should be where? in what file? Benedict PS. Sorry for a lamer question. ----- Original Message ----- From: "Andrew Arensburger" <arensb+koha-devel@ooblick.com> To: "Benedykt P. Barszcz" <kb2qzv@poczta.wp.pl> Cc: <acli@ada.dhs.org>; <koha-devel@lists.sourceforge.net> Sent: Monday, January 20, 2003 2:33 AM Subject: Re: [Koha-devel] Re: iso-8859-2 - probelm
On Mon, Jan 20, 2003 at 01:10:25AM +0100, Benedykt P. Barszcz wrote:
I don't know how to force an iso-8859-2 charset in editors on a UTF-8 aware redhat system !!!
Presumably with:
M-: (setq buffer-file-coding-system 'iso-8859-2)
-- Andrew Arensburger This message *does* represent the arensb@ooblick.com views of ooblick.com Nobody has ever, EVER learned all of Emacs.
[Rearranged to put original and reply in the correct order] On Mon, Jan 20, 2003 at 03:01:17AM +0100, Benedykt P. Barszcz wrote:
From: "Andrew Arensburger" <arensb+koha-devel@ooblick.com>
On Mon, Jan 20, 2003 at 01:10:25AM +0100, Benedykt P. Barszcz wrote:
I don't know how to force an iso-8859-2 charset in editors on a UTF-8 aware redhat system !!!
Presumably with:
M-: (setq buffer-file-coding-system 'iso-8859-2) And this line should be where? in what file?
In Emacs, type <esc> : (setq buffer-file-coding-system 'iso-8859-2) <return> You could also put this in ~/.emacs , but it would depend on where you wanted to use iso-8859-2. If you wanted to do it for all HTML files, add (add-hook 'html-mode-hook (lambda nil (setq buffer-file-coding-system 'iso-8859-2))) to ~/.emacs . If you wanted to use iso-8859-2 everywhere by default, I'd use (add-hook 'view-mode-hook (lambda nil (setq buffer-file-coding-system 'iso-8859-2))) someplace near the top of ~/.emacs , before it gets overwritten by other customization hooks. -- Andrew Arensburger This message *does* represent the arensb@ooblick.com views of ooblick.com "I use emacs, which might be thought of as a thermonuclear word processor." -- Neal Stephenson, "In the Beginning Was the Command Line"
Hi, Benedict, which editor do you use? That line is for emacs. If you use another editor it will be different. Ambrose On Mon, Jan 20, 2003 at 03:01:17AM +0100, Benedykt P. Barszcz wrote:
And this line should be where? in what file? Benedict
PS. Sorry for a lamer question.
----- Original Message -----
From: "Andrew Arensburger" <arensb+koha-devel@ooblick.com>
[...]
M-: (setq buffer-file-coding-system 'iso-8859-2)
-- Ambrose Li <a.c.li@ieee.org>
Hi, On Mon, Jan 20, 2003 at 01:10:25AM +0100, Benedykt P. Barszcz wrote:
I am waiting for the programmers of Koha to make their move. This week I am going to upgrade to Redhat 8.0. I heard from a friend of mine that thay (at RedHat) have switched to UTF-8 in the whole distribution. Will it influence my translation? If so, the whole transition will be put on hold on my part. I don't know how to force an iso-8859-2 charset in editors on a UTF-8 aware redhat system !!!
If Red Hat switched to UTF-8 for the whole distribution the Chinese might not be very happy :-) If Red Hat switches to UTF-8 and it affects Polish, you have a few choices: 1. Force the whole Red Hat to use ISO-8859-2 again. For this, I believe you change the LANG setting in the /etc/sysconfig/i18n file. You probably don't want to do this. 2. Switch to UTF-8 for the Polish translation. If you choose (2) you might want to (for the sake of not confusing yourself when you open the old files) convert all the ISO-8859-2 files to UTF-8. You can use the "iconv" command to do this. 3. Leave the system in UTF-8, but edit the Koha translations in ISO-8859-2. Using emacs is one option; if you use vi, it should basically be starting rxvt or another terminal emulator in iso-8859-2 mode and changing the LANG variable once you get into the terminal emulator. Ambrose -- Ambrose Li <a.c.li@ieee.org>
participants (5)
-
acli@ada.dhs.org via news-to-mail gateway -
Ambrose Li -
Andrew Arensburger -
Benedict -
Benedykt P. Barszcz