Hi all,

A think a point has been missed about filtering. One of the sites my company has worked on sells holidays in Europe. They get a lot of customers from all around the world and so we get people entering their names with 'funny' characters in all the time.

One of the items that they sell goes through an XML service. We pass in names and such as part of the call. The call will be rejected if any non-word, non-space characters are passed in. It accepts all accented word characters and characters in other scripts, but wont accept ' or $, for example.

Using getAlpha( $name ) is no good - it won't recognise, for example François

getAlpha( $name, $locale ) is no good because we have no idea ahead of time which locale is appropriate.

Would it not be better to have getAlpha( $name ) be inclusive of all alpha characters, and have the locale aware version be more specific?

Thomas Weidner wrote:



Hy,

Maybe we must rethink the whole filtering thingy. I would propose to
split out the locale-dependant filters from Zend_Filter and put them
into - let's say - Zend_Locale_Filter. Zend_Locale_Filter has a lot of
subclasses, for instance Zend_Locale_Filter_German,
Zend_Locale_Filter_English, Zend_Locale_Filter_Japanese, etc. which
implements the filters for there own needs. Zend_Locale_Filter has a
factory class, were you can pass a Zend_Locale object or a simple locale
string to make sure, the correct subclass is instanced. Maybe there is
no other chance to ship around this locale-aware filter problem.


Making 126 subclasses, one for every language, is a very bad design idea.

Why not making the filter locale aware ?
Exactly therefor we created the complete Zend_Locale classes bunch.

Filter without locale only recognising a-z
getAlpha($content);

Filtering with locale recognising locale letters for example german including ä, ö, ü, ß
getAlpha($content, $locale);

Zend_Locale is not meant to be extended for every usecase from other classes.

There is a general approach for usage which should be used by all classes
which want to be locale aware.

Greeting
Thomas
(I18N Team Leader and Author)



--
*Mat Scales*
Developer, Magic Number Media Ltd

e: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> | t: 0114 201 5708 | f: 0114 221 1834 | w: http://www.magicnumber.co.uk © Magic Number Media Ltd 2004, reproduction prohibited without express permission.

Magic Number Media Ltd is a registered company in England and Wales. Company No. 5241998.

Reply via email to