mudshark — 2010-04-12T05:54:44-04:00 — #1
I'm using CodeIgniter to set up a shopping cart. In doing so, I noticed that CI does not allow any products with accented characters to be added to the cart. This is defined in the following regex:
var $product_name_rules = '\\.\\:\\-_ a-z0-9'; // alpha-numeric, dashes, underscores, colons or periods
However, I'm having to add products with names such as "Côtes du Rhône", or "Crème d’Abricot", which have accents as well as the occasional apostrophe.
Question: how do I modify the above regex to include these characters?
mudshark — 2010-04-12T06:00:37-04:00 — #2
Wanted to add that alternatively, any regex that will allow for html-entities would do the trick as well, for instance with a product name such as "Cuveé du Vigneron" (é = #233 html entity)...
anthonysterling — 2010-04-12T06:01:24-04:00 — #3
Have you looked into why it doesn't allow them to be added to the cart? Personally I cannot think of one, other than the URI filtering it applies to routes, but you may find there's a reason behind it.
Just a thought.
mudshark — 2010-04-12T06:09:15-04:00 — #4
I hav thought about why they would do that - security reasons I guess. However, if I could just have a regex that allows for html-entities, I'd be good to go, and the regex would still exclude any "dangerous" characters...