From f1ee2c15177e8863369e0223edca1f6d1b34e0df Mon Sep 17 00:00:00 2001 From: sakamocchi Date: Sat, 24 Mar 2012 10:58:21 +0900 Subject: [PATCH] =?utf8?q?FIX:=20=E5=86=86=E3=83=9E=E3=83=BC=E3=82=AF?= =?utf8?q?=E3=82=92=E3=83=90=E3=83=83=E3=82=AF=E3=82=B9=E3=83=A9=E3=83=83?= =?utf8?q?=E3=82=B7=E3=83=A5=E3=81=AB=E7=BD=AE=E6=8F=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit UTF-8/Shift_JIS間の変換を繰り返したため以下が発生しました。これはその修正コミットです。 UTF-8からShift_JIS: バックスラッシュは円マーク(0x5C)として認識された Shift_JISからUTF-8: 円マークが2バイト(0xC2A5)に変換された 背景: UTF-8の文字集合であるUCS-2はバックスラッシュ(backslash)と円マーク(yen sign)のそれぞれにコードポイントを割り当て、別々のキャラクターとして扱う。そのためこれらは、UTF-8において異なるバイナリーとなり、前者は0x5Cに、後者は0xC2A5に符号化される。 対してShift_JISの文字集合のひとつであるJIS X 0201(英数字と約物、片仮名を含む)はこれら2つのうち円マークしか規定していない。そのためShift_JISはバックスラッシュを扱うことができず、円マークを0x5Cに符号化する。 なおISO 8859シリーズはいずれも、バックスラッシュは符号化対象文字列に持つものの、円マークは以下の4つしか持たない。この場合、バックスラッシュは0x5Cに、円マークは0xA5に符号化される。 ISO-8859-1 ISO-8859-8 ISO-8859-9 ISO-8859-15 --- install/index.php | 104 +++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/install/index.php b/install/index.php index b5c4291..37a364b 100644 --- a/install/index.php +++ b/install/index.php @@ -243,7 +243,7 @@ function show_header() { echo ' class="gry"'; } - echo '>  >  ', _STEP3, "Â¥n"; + echo '>  >  ', _STEP3, "\n"; } if ( in_array($param->state, array('mysql', 'weblog', 'detail')) ) { @@ -290,7 +290,7 @@ function show_select_locale_form() $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); foreach ($languages as $language) { - $language = preg_replace('#([Â¥w]+).*#', '$1', $language); + $language = preg_replace('#([\w]+).*#', '$1', $language); break; } @@ -310,12 +310,12 @@ function show_select_locale_form() $locale[1]Â¥n"; + echo ">$locale[1]\n"; } ?> @@ -369,7 +369,7 @@ function show_database_setting_form($isPostback) { foreach ( $errors as $error ) { - echo '', $error, "Â¥n"; + echo '', $error, "\n"; } } } @@ -431,7 +431,7 @@ function show_blog_setting_form($isPostback) { foreach ( $errors as $error ) { - echo '', $error, "Â¥n"; + echo '', $error, "\n"; } } } @@ -460,7 +460,7 @@ function show_blog_setting_form($isPostback) { foreach ( $errors as $error ) { - echo '', $error, "Â¥n"; + echo '', $error, "\n"; } } } @@ -513,7 +513,7 @@ function show_detail_setting_form($isPostback) check_all_parameters() ) { - echo '', _ERROR26, "Â¥n"; + echo '', _ERROR26, "\n"; } ?>

@@ -541,7 +541,7 @@ function show_detail_setting_form($isPostback) { foreach ( $errors as $error ) { - echo '', $error, "¥n"; + echo '', $error, "\n"; } } } @@ -580,7 +580,7 @@ function show_detail_setting_form($isPostback) { foreach ( $errors as $error ) { - echo '', $error, "¥n"; + echo '', $error, "\n"; } } $errors = $param->check_path_parameters(); @@ -588,7 +588,7 @@ function show_detail_setting_form($isPostback) { foreach ( $errors as $error ) { - echo '', $error, "¥n"; + echo '', $error, "\n"; } } } @@ -647,7 +647,7 @@ function show_detail_setting_form($isPostback) { foreach ( $errors as $error ) { - echo '', $error, "¥n"; + echo '', $error, "\n"; } } } @@ -687,7 +687,7 @@ function show_detail_setting_form($isPostback) { foreach ( $errors as $error ) { - echo '', $error, "¥n"; + echo '', $error, "\n"; } } } @@ -733,7 +733,7 @@ function show_install_complete_form() echo _ERROR27; foreach ( $errors as $error ) { - echo '', $error, "¥n"; + echo '', $error, "\n"; } } else @@ -900,11 +900,11 @@ function do_install() $queries = fread($fd, filesize($filename) ); fclose($fd); - $queries = preg_split('#(;¥n|;¥r)#', $queries); + $queries = preg_split('#(;\n|;\r)#', $queries); foreach ( $queries as $query ) { - if ( preg_match('/¥w+/', $query) ) + if ( preg_match('/\w+/', $query) ) { if ( $MYSQL_PREFIX ) { @@ -1020,36 +1020,36 @@ function do_install() /* * 8. Write config file ourselves (if possible) */ - $config_data = '<' . '?php' . "¥n"; - $config_data .= "// mySQL connection information¥n"; - $config_data .= "¥$MYSQL_HOST = '" . $MYSQL_HOST . "';¥n"; - $config_data .= "¥$MYSQL_USER = '" . $MYSQL_USER . "';¥n"; - $config_data .= "¥$MYSQL_PASSWORD = '" . $MYSQL_PASSWORD . "';¥n"; - $config_data .= "¥$MYSQL_DATABASE = '" . $MYSQL_DATABASE . "';¥n"; - $config_data .= "¥$MYSQL_PREFIX = '" . $MYSQL_PREFIX . "';¥n"; - $config_data .= "// new in 3.50. first element is db handler, the second is the db driver used by the handler¥n"; - $config_data .= "// default is ¥$MYSQL_HANDLER = array('mysql','mysql');¥n"; - $config_data .= "//¥$MYSQL_HANDLER = array('mysql','mysql');¥n"; - $config_data .= "//¥$MYSQL_HANDLER = array('pdo','mysql');¥n"; - $config_data .= "¥$MYSQL_HANDLER = array('".$MYSQL_HANDLER[0]."','".$MYSQL_HANDLER[1]."');¥n"; - $config_data .= "¥n"; - $config_data .= "// main nucleus directory¥n"; - $config_data .= "¥$DIR_NUCLEUS = '" . $DIR_NUCLEUS . "';¥n"; - $config_data .= "¥n"; - $config_data .= "// path to media dir¥n"; - $config_data .= "¥$DIR_MEDIA = '" . $DIR_MEDIA . "';¥n"; - $config_data .= "¥n"; - $config_data .= "// extra skin files for imported skins¥n"; - $config_data .= "¥$DIR_SKINS = '" . $DIR_SKINS . "';¥n"; - $config_data .= "¥n"; - $config_data .= "// these dirs are normally sub dirs of the nucleus dir, but ¥n"; - $config_data .= "// you can redefine them if you wish¥n"; - $config_data .= "¥$DIR_PLUGINS = ¥$DIR_NUCLEUS . 'plugins/';¥n"; - $config_data .= "¥$DIR_LOCALES = ¥$DIR_NUCLEUS . 'locales/';¥n"; - $config_data .= "¥$DIR_LIBS = ¥$DIR_NUCLEUS . 'libs/';¥n"; - $config_data .= "¥n"; - $config_data .= "// include libs¥n"; - $config_data .= "include(¥$DIR_LIBS.'globalfunctions.php');¥n"; + $config_data = '<' . '?php' . "\n"; + $config_data .= "// mySQL connection information\n"; + $config_data .= "\$MYSQL_HOST = '" . $MYSQL_HOST . "';\n"; + $config_data .= "\$MYSQL_USER = '" . $MYSQL_USER . "';\n"; + $config_data .= "\$MYSQL_PASSWORD = '" . $MYSQL_PASSWORD . "';\n"; + $config_data .= "\$MYSQL_DATABASE = '" . $MYSQL_DATABASE . "';\n"; + $config_data .= "\$MYSQL_PREFIX = '" . $MYSQL_PREFIX . "';\n"; + $config_data .= "// new in 3.50. first element is db handler, the second is the db driver used by the handler\n"; + $config_data .= "// default is \$MYSQL_HANDLER = array('mysql','mysql');\n"; + $config_data .= "//\$MYSQL_HANDLER = array('mysql','mysql');\n"; + $config_data .= "//\$MYSQL_HANDLER = array('pdo','mysql');\n"; + $config_data .= "\$MYSQL_HANDLER = array('".$MYSQL_HANDLER[0]."','".$MYSQL_HANDLER[1]."');\n"; + $config_data .= "\n"; + $config_data .= "// main nucleus directory\n"; + $config_data .= "\$DIR_NUCLEUS = '" . $DIR_NUCLEUS . "';\n"; + $config_data .= "\n"; + $config_data .= "// path to media dir\n"; + $config_data .= "\$DIR_MEDIA = '" . $DIR_MEDIA . "';\n"; + $config_data .= "\n"; + $config_data .= "// extra skin files for imported skins\n"; + $config_data .= "\$DIR_SKINS = '" . $DIR_SKINS . "';\n"; + $config_data .= "\n"; + $config_data .= "// these dirs are normally sub dirs of the nucleus dir, but \n"; + $config_data .= "// you can redefine them if you wish\n"; + $config_data .= "\$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n"; + $config_data .= "\$DIR_LOCALES = \$DIR_NUCLEUS . 'locales/';\n"; + $config_data .= "\$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n"; + $config_data .= "\n"; + $config_data .= "// include libs\n"; + $config_data .= "include(\$DIR_LIBS.'globalfunctions.php');\n"; $config_data .= "?" . ">"; $result = false; @@ -1123,7 +1123,7 @@ function getMySqlVersion() } else { - $result = @sql_query('SHOW VARIABLES LIKE ¥'version¥'', $conn); + $result = @sql_query('SHOW VARIABLES LIKE \'version\'', $conn); if ( $result != FALSE && @sql_num_rows($result) > 0 ) { @@ -1134,7 +1134,7 @@ function getMySqlVersion() { //$output = shell_exec('mysql -V'); $output = ( function_exists('shell_exec') ) ? @shell_exec('mysql -V') : '0.0.0'; - preg_match('@[0-9]+¥.[0-9]+¥.[0-9]+@', $output, $version); + preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version); $match = i18n::explode('.', $version[0]); if ( $match[0] == '' ) @@ -1336,7 +1336,7 @@ function do_check_files() if ( count($missingfiles) > 0 ) { - exit(implode( "¥n", $missingfiles)); + exit(implode( "\n", $missingfiles)); } } @@ -1497,7 +1497,7 @@ class PARAM_MANAGER } if ( $this->mysql_user != '' - && !preg_match('/^[a-z0-9_¥-]+$/i', $this->mysql_user) ) + && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_user) ) { $errors[] = sprintf(_ERROR2, _DB_FIELD2); } @@ -1513,7 +1513,7 @@ class PARAM_MANAGER } if ( $this->mysql_database != '' - && !preg_match('/^[a-z0-9_¥-]+$/i', $this->mysql_database) ) + && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_database) ) { $errors[] = sprintf(_ERROR2, _DB_FIELD4); } @@ -1571,7 +1571,7 @@ class PARAM_MANAGER $this->user_password = ''; } - if ( !preg_match("/^[a-z0-9¥._+¥-]+@[a-z0-9¥._¥-]+¥.[a-z]{2,6}$/i", $this->user_email) ) + if ( !preg_match("/^[a-z0-9\._+\-]+@[a-z0-9\._\-]+\.[a-z]{2,6}$/i", $this->user_email) ) { $errors[] = _ERROR7; } -- 2.11.0