<form>s: +accept-charset="iso-8859-2"
authorshort <>
Thu, 20 Jun 2002 14:12:29 +0000 (14:12 +0000)
committershort <>
Thu, 20 Jun 2002 14:12:29 +0000 (14:12 +0000)
 - fixed CSacek-2.1.9-incompatibility
   - temporary workaround, to be removed when CSacek supports input "utf-8"
 - fixed (cosmetic IRL) HTML-4.01 non-compliance
 - for more details see common.php/form_charset()
<form>s: +enctype="application/x-www-form-urlencoded"
 - should be default (HTML-4.01), just to be sure

common.php
index.php

index 655c7ed..528f671 100644 (file)
@@ -565,6 +565,21 @@ function input_text($name,$size,$default_value="",$addons="")
        return($r);
 }
 
+function form_charset()
+{
+       // CSacek-2.1.9+ required (mod_czech support dropped!)
+       // We MUST have input coded in "iso-8859-2" as we use
+       // "csacekRecodeInput Off", CSacek otherwise tries to recode input but CSacek
+       // _cannot_ know the encoding used by the client (moreover it IGNORES POST
+       // data MIME type, even if provided by Lynx 2.8.4dev.11, Mozilla 1.0.0
+       // doesn't provide anything).
+       // "iso-8859-2" should be replaced by $HTTP_SERVER_VARS["HTTP_X_CLIENT_CHARSET"]
+       // and "csacekRecodeInput On"(default) when CSacek fixes support of "utf-8"
+       // input-decoding, details in my mail <20020620134930.GA18761@short.ucw.cz>.
+
+       return('enctype="application/x-www-form-urlencoded" accept-charset="iso-8859-2"');
+}
+
 function print_form_radkova_inzerce($readonly,$total,$submit_name,$submit_value)
 {
        global $have_js,$text,$doklad;
@@ -572,7 +587,7 @@ function print_form_radkova_inzerce($readonly,$total,$submit_name,$submit_value)
        $addons=(!$readonly ? "" : " readonly=\"readonly\"");
        ?>
 <blockquote>
-<form action="inzerat-submit.php<?php print($have_js); ?>" method="post">
+<form action="inzerat-submit.php<?php print($have_js); ?>" method="post" <?php print(form_charset()); ?>>
 <table border="1" width="100%" cellpadding="5">
 <tr><td align="center"><table border="0">
        <tr><td align="left" class="tab-head">Text inzerátu</td></tr>
@@ -696,18 +711,15 @@ function no_cache()
 
 function heading($title=false)
 {
-       global $HTTP_SERVER_VARS,$msie_major,$mozilla_major,$title_tail,$head_css,$have_css,$head,$heading_done,$title_prefix,$force_charset;
+       global $msie_major,$mozilla_major,$title_tail,$head_css,$have_css,$head,$heading_done,$title_prefix,$force_charset;
 
        if (isset($heading_done))
                return;
        $heading_done=true;
 
-       if (isset($force_charset))
-               $client_charset=$force_charset;
-       else
-               $client_charset=(!isset($HTTP_SERVER_VARS["CLIENT_CHARSET"]) ? "iso-8859-2" : $HTTP_SERVER_VARS["CLIENT_CHARSET"]);
-       // When "CLIENT_CHARSET" is set we MUST NOT explicitely specify our "charset"
-       header("Content-type: text/html".(isset($HTTP_SERVER_VARS["CLIENT_CHARSET"]) ? "" : "; charset=$client_charset"));
+       // $HTTP_SERVER_VARS["CLIENT_CHARSET"] ignored (mod_czech support dropped!)
+       $client_charset=(isset($force_charset) ? $force_charset : "iso-8859-2");
+       header("Content-type: text/html; charset=$client_charset");
        header("Content-Style-Type: text/css");
        if (!isset($msie_major) || $msie_major>=4) {
                print('<?xml version="1.0" encoding="'.$client_charset.'"?>'."\n");
index 724a636..67b7a8a 100644 (file)
--- a/index.php
+++ b/index.php
@@ -45,7 +45,7 @@
 <p>&nbsp;</p>
 
 <h2><a id="objednavka">Objednávka èasopisu</a></h2>
-<form action="objednavka.php<?php print($have_js); ?>" method="post">
+<form action="objednavka.php<?php print($have_js); ?>" method="post" <?php print(form_charset()); ?>>
 <table border="0" width="100%">
 <tr><td align="center"><table border="1" width="90%" cellpadding="5">
 <tr><td align="center"><table border="0">