OSDN Git Service

Modify startUpError function to indicate correct charset encoding in its HTTP header.
authorsakamocchi <sakamocchi@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Fri, 28 Jan 2011 03:46:36 +0000 (03:46 +0000)
committersakamocchi <sakamocchi@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Fri, 28 Jan 2011 03:46:36 +0000 (03:46 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@1111 1ca29b6e-896d-4ea0-84a5-967f57386b96

utf8/nucleus/libs/sql/mysql.php
utf8/nucleus/libs/sql/pdo.php

index bca3001..856579f 100755 (executable)
@@ -31,12 +31,20 @@ if (function_exists('mysql_query') && !function_exists('sql_fetch_assoc'))
         *Errors before the database connection has been made
         */
        function startUpError($msg, $title) {
+               if (!defined('_CHARSET')) {
+                       define('_CHARSET', 'UTF-8');
+               }
+               if (!defined('_HTML_XML_NAME_SPACE_AND_LANG_CODE')) {
+                       define('_HTML_XML_NAME_SPACE_AND_LANG_CODE', 'xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us"');
+               }
+               sendContentType('text/html','',_CHARSET);
                ?>
-<html xmlns="http://www.w3.org/1999/xhtml">
-       <head><title><?php echo htmlspecialchars($title)?></title></head>
+<html <?php echo _HTML_XML_NAME_SPACE_AND_LANG_CODE; ?>>
+       <head><meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET?>" />
+       <title><?php echo htmlspecialchars($title,ENT_QUOTES)?></title></head>
        <body>
-               <h1><?php echo htmlspecialchars($title)?></h1>
-               <?php echo $msg?>
+               <h1><?php echo htmlspecialchars($title,ENT_QUOTES)?></h1>
+               <?php echo $msg?> 
        </body>
 </html>
 <?php
index 8d47de2..300acfb 100755 (executable)
@@ -33,15 +33,24 @@ if (!function_exists('sql_fetch_assoc'))
  * Errors before the database connection has been made
  */
        function startUpError($msg, $title) {
+               if (!defined('_CHARSET')) {
+                       define('_CHARSET', 'UTF-8');
+               }
+               if (!defined('_HTML_XML_NAME_SPACE_AND_LANG_CODE')) {
+                       define('_HTML_XML_NAME_SPACE_AND_LANG_CODE', 'xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us"');
+               }
+               sendContentType('text/html','',_CHARSET);
                ?>
-               <html xmlns="http://www.w3.org/1999/xhtml">
-                       <head><title><?php echo htmlspecialchars($title)?></title></head>
-                       <body>
-                               <h1><?php echo htmlspecialchars($title)?></h1>
-                               <?php echo $msg?>
-                       </body>
-               </html>
-               <?php   exit;
+<html <?php echo _HTML_XML_NAME_SPACE_AND_LANG_CODE; ?>>
+       <head><meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET?>" />
+       <title><?php echo htmlspecialchars($title,ENT_QUOTES)?></title></head>
+       <body>
+               <h1><?php echo htmlspecialchars($title,ENT_QUOTES)?></h1>
+               <?php echo $msg?> 
+       </body>
+</html>
+<?php
+               exit;
        }
        
 /**