[PHP-DEV] cvs: /php3 ChangeLog main.c mod_php3.c mod_php3.h php3.ini-dist From: Rasmus Lerdorf (rasmus <email protected>)
Date: 01/29/00

rasmus Sat Jan 29 11:33:04 2000 EDT

  Modified files:
    /php3 ChangeLog main.c mod_php3.c mod_php3.h php3.ini-dist
  Log:
  Add .ini option to set the default text/html charset
  
  
Index: php3/ChangeLog
diff -u php3/ChangeLog:1.815 php3/ChangeLog:1.816
--- php3/ChangeLog:1.815 Mon Jan 17 12:03:44 2000
+++ php3/ChangeLog Sat Jan 29 11:33:04 2000
@@ -4,6 +4,8 @@
 ???, Version 3.0.15
 - Support for LZW-compressed GIFs with gd 1.5, gd/freetype cleanups (markonen)
 - Added IMAP modified UTF-7 encode/decode routines (Andrew Skalski)
+- Add .ini option to set the default charset for the default text/html mime
+ type that php serves up (Rasmus)
 
 January 11, 2000, Version 3.0.14
 - Fixed broken GD autoconf check - GIF support was not detected unless libpng
Index: php3/main.c
diff -u php3/main.c:1.511 php3/main.c:1.512
--- php3/main.c:1.511 Fri Dec 31 20:31:12 1999
+++ php3/main.c Sat Jan 29 11:33:04 2000
@@ -29,7 +29,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: main.c,v 1.511 2000/01/01 04:31:12 sas Exp $ */
+/* $Id: main.c,v 1.512 2000/01/29 19:33:04 rasmus Exp $ */
 
 /* #define CRASH_DETECTION */
 
@@ -1053,6 +1053,13 @@
                                 php3_ini.include_path = temp;
                         } else {
                                 php3_ini.include_path = NULL;
+ }
+ }
+ if (cfg_get_string("charset", &php3_ini.charset) == FAILURE) {
+ if ((temp = getenv("PHP_CHARSET"))) {
+ php3_ini.charset = temp;
+ } else {
+ php3_ini.charset = NULL;
                         }
                 }
                 if (cfg_get_string("auto_prepend_file", &php3_ini.auto_prepend_file) == FAILURE) {
Index: php3/mod_php3.c
diff -u php3/mod_php3.c:1.98 php3/mod_php3.c:1.99
--- php3/mod_php3.c:1.98 Sat Jan 29 04:42:55 2000
+++ php3/mod_php3.c Sat Jan 29 11:33:04 2000
@@ -27,7 +27,7 @@
    | (with helpful hints from Dean Gaudet <dgaudet <email protected>> |
    +----------------------------------------------------------------------+
  */
-/* $Id: mod_php3.c,v 1.98 2000/01/29 12:42:55 rasmus Exp $ */
+/* $Id: mod_php3.c,v 1.99 2000/01/29 19:33:04 rasmus Exp $ */
 
 #include "httpd.h"
 #include "http_config.h"
@@ -188,7 +188,7 @@
          * directive, then decline to handle this request
          */
         if (!conf->engine) {
- r->content_type = "text/html;charset=iso-8859-1";
+ r->content_type = "text/html";
                 r->allowed |= (1 << METHODS) - 1;
                 return DECLINED;
         }
@@ -220,7 +220,13 @@
         }
         /* Assume output will be HTML. Individual scripts may change this
            further down the line */
- r->content_type = "text/html;charset=iso-8859-1";
+ if(conf->charset) {
+ r->content_type = (char *)malloc(strlen(conf->charset)+19);
+ strcpy((char *)r->content_type,"text/html;charset=");
+ strcpy((char *)r->content_type+18,conf->charset);
+ } else {
+ r->content_type = "text/html";
+ }
 
         /* Init timeout */
         hard_timeout("send", r);
@@ -238,6 +244,7 @@
         php3_restore_umask();
         kill_timeout(r);
         pclosef(r->pool, fd);
+ if(conf->charset) free((char *)r->content_type);
         return OK;
 }
 
@@ -308,6 +315,7 @@
         if (add->isapi_ext != base->isapi_ext) new->isapi_ext = add->isapi_ext;
         if (add->nsapi_ext != base->nsapi_ext) new->nsapi_ext = add->nsapi_ext;
         if (add->include_path != base->include_path) new->include_path = add->include_path;
+ if (add->charset != base->charset) new->charset = add->charset;
         if (add->auto_prepend_file != base->auto_prepend_file) new->auto_prepend_file = add->auto_prepend_file;
         if (add->auto_append_file != base->auto_append_file) new->auto_append_file = add->auto_append_file;
         if (add->upload_tmp_dir != base->upload_tmp_dir) new->upload_tmp_dir = add->upload_tmp_dir;
@@ -503,6 +511,9 @@
                 case 20:
                         conf->dav_script = pstrdup(cmd->pool, arg);
                         break;
+ case 21:
+ conf->charset = pstrdup(cmd->pool, arg);
+ break;
         }
         return NULL;
 }
@@ -609,6 +620,7 @@
         {"php3_dav_script", php3take1handler, (void *)20, OR_OPTIONS|RSRC_CONF, TAKE1,
          "Lets PHP handle DAV requests by parsing this script."},
 #endif
+ {"php3_charset", php3take1handler, (void *)21, OR_OPTIONS, TAKE1, "charset"},
         {"php3_track_errors", php3flaghandler, (void *)0, OR_OPTIONS, FLAG, "on|off"},
         {"php3_magic_quotes_gpc", php3flaghandler, (void *)1, OR_OPTIONS, FLAG, "on|off"},
         {"php3_magic_quotes_runtime", php3flaghandler, (void *)2, OR_OPTIONS, FLAG, "on|off"},
Index: php3/mod_php3.h
diff -u php3/mod_php3.h:1.53 php3/mod_php3.h:1.54
--- php3/mod_php3.h:1.53 Fri Dec 31 20:44:07 1999
+++ php3/mod_php3.h Sat Jan 29 11:33:04 2000
@@ -23,10 +23,10 @@
    | If you did not, or have any questions about PHP licensing, please |
    | contact core <email protected> |
    +----------------------------------------------------------------------+
- | Authors: Rasmus Lerdorf <rasmus <email protected>> |
+ | Authors: Rasmus Lerdorf <rasmus <email protected>> |
    +----------------------------------------------------------------------+
  */
-/* $Id: mod_php3.h,v 1.53 2000/01/01 04:44:07 sas Exp $ */
+/* $Id: mod_php3.h,v 1.54 2000/01/29 19:33:04 rasmus Exp $ */
 
 #ifndef _MOD_PHP3_H
 #define _MOD_PHP3_H
@@ -93,6 +93,7 @@
         long ignore_user_abort;
         char *dav_script;
         long expose_php;
+ char *charset;
 } php3_ini_structure;
 
 #if MSVC5
Index: php3/php3.ini-dist
diff -u php3/php3.ini-dist:1.55 php3/php3.ini-dist:1.56
--- php3/php3.ini-dist:1.55 Fri Dec 3 05:40:38 1999
+++ php3/php3.ini-dist Sat Jan 29 11:33:04 2000
@@ -55,6 +55,7 @@
                         ; It is no security threat in any way, but it makes it possible
                         ; to determine whether you use PHP on your server or not.
 
+; charset = iso-8859-1 ; This sets the charset for the default text/html type served up by PHP
 
 ;;;;;;;;;;;;;;;;;;;
 ; Resource Limits ;

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>