ZF-6359: Filters should work for UTF8 strings when used in Zend_Form

Issue Type: Bug Created: 2009-04-21T05:03:04.000+0000 Last Updated: 2012-11-20T20:53:10.000+0000 Status: Closed Fix version(s): Reporter: Tomáš Fejfar ( Assignee: None Tags: - Zend_Form

Related issues: Attachments:


Zend_Filter offers $filter->setEncoding('utf-8'), but when used with Zend_Form developer can't set that anywhere cetrally. There should be a static call to set encoding to UTF-8 for all filters application-wide.

Current workaround is to create Filters separetly and set encoding for each of them.


Posted by Thomas Weidner (thomas) on 2009-04-21T10:39:31.000+0000

Lowering priority as there is already a workaround.

Posted by Thomas Weidner (thomas) on 2009-04-21T10:40:34.000+0000

Note that such a change would introduce a BC and would therefor only be allowed for ZF2.0

Posted by Tomáš Fejfar ( on 2009-04-21T11:54:02.000+0000

What is BC? Backward Compatibiliry? How would that affect BC. Z_Filter already has abbility to work with UTF-8 (via setEncoding()) so it could be done somehow in Zend_Form... like $form->setEncoding('UTF-8') and this will be send to every filter in form via setEncoding().

Developer then can extend Zend_Form to set encoding in init().

Posted by Thomas Weidner (thomas) on 2009-04-21T12:01:58.000+0000

Changing Instance to Static within Zend_Filter as proposed would mean that it is no longer possible to set one filter to UTF8 and another one to ISO for example.

This is definitly a BC break and therefor ONLY allowed for major releases.

Posted by Tomáš Fejfar ( on 2009-04-21T12:17:09.000+0000

Ah, I see... I doesn't have to be static call... that was just an idea ;) The thing I wanted was "Filters should work for UTF8 strings when used in Zend_Form". It's not important how it will be done. It can be done in cycle from Zend_Form for example... I don't feel like qualified enough to make the choice where and how.

Posted by Matthew Weier O'Phinney (matthew) on 2009-04-21T12:36:07.000+0000

I can see a potential for an element level "setFilterEncoding", and a form level "setFilterEncoding" method. But then the question arises of whether there should just be "setEncoding" methods -- and would those propagate to the view helpers as well? There's a lot to consider here. None of these would be BC violations -- but all are non-trivial to add.

Posted by Thomas Weidner (thomas) on 2009-04-21T12:50:42.000+0000

I would propose the following:

Filters should be allowed to set encoding per filter as actually done. Additionally it should be possible to set the encoding as option (options array should be allowed by all filters and partitially they are already).

Form should add encoding option.

When Form sets encoding then this encoding should be used within the attached filter of this form. EXCEPT a encoding has manually be specified to the filter. So only the default encoding should be set by Form.

This way would allow to set encoding once within Zend_Form and promote it to the filters. And it would allow to set a different encoding to special filters when this should be necessary.

Posted by Thomas Weidner (thomas) on 2009-09-11T14:56:21.000+0000

All filters support now 'encoding' as options array when they have UTF-8 support. Therefor detaching Zend_Filter from the issued components.

Posted by Rob Allen (rob) on 2012-11-20T20:53:10.000+0000

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.