I'll run some tests on it tomorrow, but I think that Zend_Filter_Input pulls
from the post variables in the request object, which are processed before
the $_POST variable that you set above would be set.
Unicode issues are *tricky* to get pinned down. You also need to have the
right charset being passed in the headers from the server, the right
override in your browser, etc. so on so forth. We've had problems with a
bunch of our servers when they were going through a misconfigured squid
cache that stripped the UTF-8 headers off ... but only when you hit it with
a request for the site in the Turkish charset. All kinds of things could
cause the behaviour you're seeing. And knowing how much translation and
internationalization that is happening, I think we'd have seen this fairly
simple case show up before now.
-K
On Tue, Mar 25, 2008 at 11:53 PM, Philip G <[EMAIL PROTECTED]> wrote:
>
> Well, the script I wrote was a hack job to show what I was doing.
> Technically, the data is being based through _POST. Are you saying the only
> way to get this to work is to Unicode the scripts on the file system? I
> never herd of that requirement.
>
> I'm trying to make a form submit function more unicode friendly. I have
> the required UTF-8 accet charset in place. I have verified that 'Bertrán'
> is being passed across properly. I even verified that PHP doesn't mess with
> it (by printing out _POST). However, once it goes through the filter
> process, it gets stripped.
>
> Philip
>
>
> On Tue, Mar 25, 2008 at 7:20 PM, Guillaume Rossolini <
> [EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > I suppose the script is encoded as Unicode in your filesystem? Your
> > sample code fails if encoded as ANSI, but succeeds if encoded as UTF-8.
> >
> > <?php
> > require_once 'Zend/Filter/Input.php';
> >
> > $_POST['first_nm'] = "Bertrán";
> >
> > $filters = array ( 'first_nm' => 'Alpha' );
> > $validators = array( 'first_nm' => array ('Alpha', 'presence' =>
> > 'required') );
> > $input = new Zend_Filter_Input($filters, $validators, $_POST);
> >
> > echo $input->isValid() ? 'ok' : 'dead';
> >
> >
> > Regards,
> >
> >
> >
> >
> > On 3/25/08, Philip G <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > I'm trying to get a form to validate with unicode characters.
> > >
> > > For a very simple example, I have:
> > >
> > > $_POST['first_nm'] = "Bertrán";
> > >
> > > $filters = array ( 'first_nm' => 'Alpha' );
> > > $validators = array( 'first_nm' => array ('Alpha', 'presence' =>
> > > 'required) );
> > > $input = Zend_Filter_Input($filter, $validators, $_POST);
> > >
> > >
> > > Now, a simple $input->isValid() call and it fails. Returns: [first_nm]
> > > => Array ( [stringEmpty] => ' ' is an empty string )
> > >
> > > Is there something special I need to do in order to get
> > > Zend_Filter_Input to understand UTF-8? I've checked the data being passed
> > > to
> > > PHP; it is valid. I checked the code and it seems to do some utf8 check,
> > > but
> > > apparently it's not working for some reason.
> > >
> > > Thanks
> > >
> > > --
> > > Philip
> > > [EMAIL PROTECTED]
> > > http://www.gpcentre.net/
> >
> >
> >
> >
> > --
> > Guillaume Rossolini
>
>
>
>
> --
> Philip
> [EMAIL PROTECTED]
> http://www.gpcentre.net/
>