You are here:  » Validate special chars

Support Forum



Validate special chars

Submitted by mediacode on Tue, 2012-01-24 23:43 in

Hello David,

when I try to add a new category in the admin section it returns an error like "category name contains invalid characters" when I submit. Yes, the category wich i need contains specials chars e.g. ć,š,č,ž,đ.
These are bosnian chars wich i need it to make avaiable on my site.

Can you explain me how can i fix that please?

Best regards, Almir.

Submitted by support on Wed, 2012-01-25 03:30

Hello Almir,

The script does correctly URL encode special characters but for legacy reasons restricted characters in category mapping however to enable categories without restrictions, in admin/categories.php look for the following code at line 20:

if(!preg_match("/^[0-9a-zA-Z\. ]{0,255}$/",widget_posted($_POST["name"])))

...and REPLACE with:

if(FALSE)

That should do the trick - if you are not sure of the changes of course let me know and I will email the required modifications to you...

Cheers,
David.
--
PriceTapestry.com

Submitted by mediacode on Wed, 2012-01-25 08:19

Hi David,

thanks for your support! It works properly!

I guess that works too?
if(Validate::Name($_POST["name"],$myCondition))

Thank you and best regards.

Submitted by support on Wed, 2012-01-25 08:44

Hello Almir,

Sure you could use the PEAR Validate class for this purpose if you wish; I quickly checked the documentation and I don't see Name specifically mentioned but Validate::string could certainly be used to prevent non-printable characters being included...

Cheers,
David.
--
PriceTapestry.com