|
@@ -212,8 +212,8 @@ class Zend_Locale_Format
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
for ($x = 0; $x < 10; ++$x) {
|
|
for ($x = 0; $x < 10; ++$x) {
|
|
|
- $asource[$x] = "/" . iconv_substr($source, $x, 1) . "/u";
|
|
|
|
|
- $atarget[$x] = iconv_substr($target, $x, 1);
|
|
|
|
|
|
|
+ $asource[$x] = "/" . iconv_substr($source, $x, 1, 'UTF-8') . "/u";
|
|
|
|
|
+ $atarget[$x] = iconv_substr($target, $x, 1, 'UTF-8');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return preg_replace($asource, $atarget, $input);
|
|
return preg_replace($asource, $atarget, $input);
|
|
@@ -299,6 +299,7 @@ class Zend_Locale_Format
|
|
|
|
|
|
|
|
// Get correct signs for this locale
|
|
// Get correct signs for this locale
|
|
|
$symbols = Zend_Locale_Data::getList($options['locale'], 'symbols');
|
|
$symbols = Zend_Locale_Data::getList($options['locale'], 'symbols');
|
|
|
|
|
+ $oenc = iconv_get_encoding('internal_encoding');
|
|
|
iconv_set_encoding('internal_encoding', 'UTF-8');
|
|
iconv_set_encoding('internal_encoding', 'UTF-8');
|
|
|
|
|
|
|
|
// Get format
|
|
// Get format
|
|
@@ -353,6 +354,7 @@ class Zend_Locale_Format
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (iconv_strpos($format, '0') === false) {
|
|
if (iconv_strpos($format, '0') === false) {
|
|
|
|
|
+ iconv_set_encoding('internal_encoding', $oenc);
|
|
|
require_once 'Zend/Locale/Exception.php';
|
|
require_once 'Zend/Locale/Exception.php';
|
|
|
throw new Zend_Locale_Exception('Wrong format... missing 0');
|
|
throw new Zend_Locale_Exception('Wrong format... missing 0');
|
|
|
}
|
|
}
|
|
@@ -477,6 +479,7 @@ class Zend_Locale_Format
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ iconv_set_encoding('internal_encoding', $oenc);
|
|
|
return (string) $format;
|
|
return (string) $format;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -779,6 +782,8 @@ class Zend_Locale_Format
|
|
|
$result['date_format'] = $format; // save the format used to normalize $number (convenience)
|
|
$result['date_format'] = $format; // save the format used to normalize $number (convenience)
|
|
|
$result['locale'] = $options['locale']; // save the locale used to normalize $number (convenience)
|
|
$result['locale'] = $options['locale']; // save the locale used to normalize $number (convenience)
|
|
|
|
|
|
|
|
|
|
+ $oenc = iconv_get_encoding('internal_encoding');
|
|
|
|
|
+ iconv_set_encoding('internal_encoding', 'UTF-8');
|
|
|
$day = iconv_strpos($format, 'd');
|
|
$day = iconv_strpos($format, 'd');
|
|
|
$month = iconv_strpos($format, 'M');
|
|
$month = iconv_strpos($format, 'M');
|
|
|
$year = iconv_strpos($format, 'y');
|
|
$year = iconv_strpos($format, 'y');
|
|
@@ -843,6 +848,7 @@ class Zend_Locale_Format
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (empty($parse)) {
|
|
if (empty($parse)) {
|
|
|
|
|
+ iconv_set_encoding('internal_encoding', $oenc);
|
|
|
require_once 'Zend/Locale/Exception.php';
|
|
require_once 'Zend/Locale/Exception.php';
|
|
|
throw new Zend_Locale_Exception("Unknown date format, neither date nor time in '" . $format . "' found");
|
|
throw new Zend_Locale_Exception("Unknown date format, neither date nor time in '" . $format . "' found");
|
|
|
}
|
|
}
|
|
@@ -862,6 +868,7 @@ class Zend_Locale_Format
|
|
|
preg_match_all('/\d+/u', $number, $splitted);
|
|
preg_match_all('/\d+/u', $number, $splitted);
|
|
|
|
|
|
|
|
if (count($splitted[0]) == 0) {
|
|
if (count($splitted[0]) == 0) {
|
|
|
|
|
+ iconv_set_encoding('internal_encoding', $oenc);
|
|
|
require_once 'Zend/Locale/Exception.php';
|
|
require_once 'Zend/Locale/Exception.php';
|
|
|
throw new Zend_Locale_Exception("No date part in '$date' found.");
|
|
throw new Zend_Locale_Exception("No date part in '$date' found.");
|
|
|
}
|
|
}
|
|
@@ -967,6 +974,7 @@ class Zend_Locale_Format
|
|
|
if (($position !== false) and ((iconv_strpos($date, $result['day']) === false) or
|
|
if (($position !== false) and ((iconv_strpos($date, $result['day']) === false) or
|
|
|
(isset($result['year']) and (iconv_strpos($date, $result['year']) === false)))) {
|
|
(isset($result['year']) and (iconv_strpos($date, $result['year']) === false)))) {
|
|
|
if ($options['fix_date'] !== true) {
|
|
if ($options['fix_date'] !== true) {
|
|
|
|
|
+ iconv_set_encoding('internal_encoding', $oenc);
|
|
|
require_once 'Zend/Locale/Exception.php';
|
|
require_once 'Zend/Locale/Exception.php';
|
|
|
throw new Zend_Locale_Exception("Unable to parse date '$date' using '" . $format
|
|
throw new Zend_Locale_Exception("Unable to parse date '$date' using '" . $format
|
|
|
. "' (false month, $position, $month)");
|
|
. "' (false month, $position, $month)");
|
|
@@ -982,6 +990,7 @@ class Zend_Locale_Format
|
|
|
if (isset($result['day']) and isset($result['year'])) {
|
|
if (isset($result['day']) and isset($result['year'])) {
|
|
|
if ($result['day'] > 31) {
|
|
if ($result['day'] > 31) {
|
|
|
if ($options['fix_date'] !== true) {
|
|
if ($options['fix_date'] !== true) {
|
|
|
|
|
+ iconv_set_encoding('internal_encoding', $oenc);
|
|
|
require_once 'Zend/Locale/Exception.php';
|
|
require_once 'Zend/Locale/Exception.php';
|
|
|
throw new Zend_Locale_Exception("Unable to parse date '$date' using '"
|
|
throw new Zend_Locale_Exception("Unable to parse date '$date' using '"
|
|
|
. $format . "' (d <> y)");
|
|
. $format . "' (d <> y)");
|
|
@@ -997,6 +1006,7 @@ class Zend_Locale_Format
|
|
|
if (isset($result['month']) and isset($result['year'])) {
|
|
if (isset($result['month']) and isset($result['year'])) {
|
|
|
if ($result['month'] > 31) {
|
|
if ($result['month'] > 31) {
|
|
|
if ($options['fix_date'] !== true) {
|
|
if ($options['fix_date'] !== true) {
|
|
|
|
|
+ iconv_set_encoding('internal_encoding', $oenc);
|
|
|
require_once 'Zend/Locale/Exception.php';
|
|
require_once 'Zend/Locale/Exception.php';
|
|
|
throw new Zend_Locale_Exception("Unable to parse date '$date' using '"
|
|
throw new Zend_Locale_Exception("Unable to parse date '$date' using '"
|
|
|
. $format . "' (M <> y)");
|
|
. $format . "' (M <> y)");
|
|
@@ -1012,6 +1022,7 @@ class Zend_Locale_Format
|
|
|
if (isset($result['month']) and isset($result['day'])) {
|
|
if (isset($result['month']) and isset($result['day'])) {
|
|
|
if ($result['month'] > 12) {
|
|
if ($result['month'] > 12) {
|
|
|
if ($options['fix_date'] !== true || $result['month'] > 31) {
|
|
if ($options['fix_date'] !== true || $result['month'] > 31) {
|
|
|
|
|
+ iconv_set_encoding('internal_encoding', $oenc);
|
|
|
require_once 'Zend/Locale/Exception.php';
|
|
require_once 'Zend/Locale/Exception.php';
|
|
|
throw new Zend_Locale_Exception("Unable to parse date '$date' using '"
|
|
throw new Zend_Locale_Exception("Unable to parse date '$date' using '"
|
|
|
. $format . "' (M <> d)");
|
|
. $format . "' (M <> d)");
|
|
@@ -1038,6 +1049,7 @@ class Zend_Locale_Format
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ iconv_set_encoding('internal_encoding', $oenc);
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1058,7 +1070,7 @@ class Zend_Locale_Format
|
|
|
$position = false;
|
|
$position = false;
|
|
|
if ($monthlist && $monthlist[1] != 1) {
|
|
if ($monthlist && $monthlist[1] != 1) {
|
|
|
foreach($monthlist as $key => $name) {
|
|
foreach($monthlist as $key => $name) {
|
|
|
- if (($position = iconv_strpos($number, $name)) !== false) {
|
|
|
|
|
|
|
+ if (($position = iconv_strpos($number, $name, 0, 'UTF-8')) !== false) {
|
|
|
$number = str_ireplace($name, $key, $number);
|
|
$number = str_ireplace($name, $key, $number);
|
|
|
return $position;
|
|
return $position;
|
|
|
}
|
|
}
|
|
@@ -1131,34 +1143,34 @@ class Zend_Locale_Format
|
|
|
$options = self::_checkOptions($options) + self::$_options;
|
|
$options = self::_checkOptions($options) + self::$_options;
|
|
|
|
|
|
|
|
// day expected but not parsed
|
|
// day expected but not parsed
|
|
|
- if ((iconv_strpos($options['date_format'], 'd') !== false) and (!isset($date['day']) or ($date['day'] == ""))) {
|
|
|
|
|
|
|
+ if ((iconv_strpos($options['date_format'], 'd', 0, 'UTF-8') !== false) and (!isset($date['day']) or ($date['day'] == ""))) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// month expected but not parsed
|
|
// month expected but not parsed
|
|
|
- if ((iconv_strpos($options['date_format'], 'M') !== false) and (!isset($date['month']) or ($date['month'] == ""))) {
|
|
|
|
|
|
|
+ if ((iconv_strpos($options['date_format'], 'M', 0, 'UTF-8') !== false) and (!isset($date['month']) or ($date['month'] == ""))) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// year expected but not parsed
|
|
// year expected but not parsed
|
|
|
- if (((iconv_strpos($options['date_format'], 'Y') !== false) or
|
|
|
|
|
- (iconv_strpos($options['date_format'], 'y') !== false)) and (!isset($date['year']) or ($date['year'] == ""))) {
|
|
|
|
|
|
|
+ if (((iconv_strpos($options['date_format'], 'Y', 0, 'UTF-8') !== false) or
|
|
|
|
|
+ (iconv_strpos($options['date_format'], 'y', 0, 'UTF-8') !== false)) and (!isset($date['year']) or ($date['year'] == ""))) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// second expected but not parsed
|
|
// second expected but not parsed
|
|
|
- if ((iconv_strpos($options['date_format'], 's') !== false) and (!isset($date['second']) or ($date['second'] == ""))) {
|
|
|
|
|
|
|
+ if ((iconv_strpos($options['date_format'], 's', 0, 'UTF-8') !== false) and (!isset($date['second']) or ($date['second'] == ""))) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// minute expected but not parsed
|
|
// minute expected but not parsed
|
|
|
- if ((iconv_strpos($options['date_format'], 'm') !== false) and (!isset($date['minute']) or ($date['minute'] == ""))) {
|
|
|
|
|
|
|
+ if ((iconv_strpos($options['date_format'], 'm', 0, 'UTF-8') !== false) and (!isset($date['minute']) or ($date['minute'] == ""))) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// hour expected but not parsed
|
|
// hour expected but not parsed
|
|
|
- if (((iconv_strpos($options['date_format'], 'H') !== false) or
|
|
|
|
|
- (iconv_strpos($options['date_format'], 'h') !== false)) and (!isset($date['hour']) or ($date['hour'] == ""))) {
|
|
|
|
|
|
|
+ if (((iconv_strpos($options['date_format'], 'H', 0, 'UTF-8') !== false) or
|
|
|
|
|
+ (iconv_strpos($options['date_format'], 'h', 0, 'UTF-8') !== false)) and (!isset($date['hour']) or ($date['hour'] == ""))) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
return true;
|
|
return true;
|