Quantcast

Zend_Locale_Format::_parseDate() does not split Chinese date format

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Zend_Locale_Format::_parseDate() does not split Chinese date format

Frank Quosdorf
In the bootstrap, I set an application wide locale to Chinese:

Zend_Registry::set("Zend_Locale", new Zend_Locale("zh_CN"));

In a controller, I get an instance of Zend_Date:
 
$this->view->date = new Zend_Date();

In a view script, I display the date:

<p>Date: <?=$this->date->getDate()?></p>

The view script has been meta-tagged UTF-8

When rendering the view script, Zend_Locale_Format::_parseDate() throws an exception in line 662 after unsuccessfully testing the Chinese date format string:

if ((!in_array($splitted, $test)) and (ctype_alpha($splitted)))

Did some testing replacing _parseDate's

$format = $options['date_format'];
        foreach (str_split($format) as $splitted) {

by

$format = $options['date_format'];
preg_match_all('/./u', $format, $temp);
foreach ($temp as $splitted) {

which works for me (Chinese). Seems, str_split is not multibyte-safe.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Zend_Locale_Format::_parseDate() does not split Chinese date format

Thomas Weidner
Please enter a reproductable issue in jira.
And don't forget all necessary data for reproduction.
We will look into it.

Btw: Line 662 is an iconv call... and iconv IS binary save. ;-)

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message -----
From: "frank.quosdorf" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, November 04, 2008 9:15 AM
Subject: [fw-i18n] Zend_Locale_Format::_parseDate() does not split Chinese
date format


>
> In the bootstrap, I set an application wide locale to Chinese:
>
> Zend_Registry::set("Zend_Locale", new Zend_Locale("zh_CN"));
>
> In a controller, I get an instance of Zend_Date:
>
> $this->view->date = new Zend_Date();
>
> In a view script, I display the date:
>
> <p>Date: <?=$this->date->getDate()?></p>
>
> The view script has been meta-tagged UTF-8
>
> When rendering the view script, Zend_Locale_Format::_parseDate() throws an
> exception in line 662 after unsuccessfully testing the Chinese date format
> string:
>
> if ((!in_array($splitted, $test)) and (ctype_alpha($splitted)))
>
> Did some testing replacing _parseDate's
>
> $format = $options['date_format'];
>        foreach (str_split($format) as $splitted) {
>
> by
>
> $format = $options['date_format'];
> preg_match_all('/./u', $format, $temp);
> foreach ($temp as $splitted) {
>
> which works for me (Chinese). Seems, str_split is not multibyte-safe.
>
> --
> View this message in context:
> http://www.nabble.com/Zend_Locale_Format%3A%3A_parseDate%28%29-does-not-split-Chinese-date-format-tp20317871p20317871.html
> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.

Loading...