Re: escaping values in $form->input
On Fri, May 30, 2008 at 12:48 PM, leo <[EMAIL PROTECTED]> wrote: > > It was as near as I could remember. There are others where firefox > shows playing cards instead of kanji etc. That's a character set mismatch, then, as I've suggested. > With this project, I went down that path of changing everything to > utf8 including my cat my wife my kids and my underpants. It worked in > the end. > > What nobody emphasizes, though, is that the mysql connection is utf8 > whereas everything else is utf-8 -- BIG difference. > Right. I've been bit by that more than once, in fact. But I usually use Postgres so I'm always forgetting the MySQL way of things. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: escaping values in $form->input
Well, same thing. That's not escaped, it's a character set mismatch. On Fri, May 30, 2008 at 1:23 PM, clemos <[EMAIL PROTECTED]> wrote: > > On Fri, May 30, 2008 at 6:26 PM, b logica <[EMAIL PROTECTED]> wrote: >> >>> [EMAIL PROTECTED] >> >> Is that an actual example? > > I think he meant : Ã(c) , ç , things like that... > > ++ > ClÃ(c)ment > :) > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: escaping values in $form->input
On Fri, May 30, 2008 at 6:26 PM, b logica <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] > > Is that an actual example? I think he meant : Ã(c) , ç , things like that... ++ ClÃ(c)ment :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: escaping values in $form->input
It was as near as I could remember. There are others where firefox shows playing cards instead of kanji etc. With this project, I went down that path of changing everything to utf8 including my cat my wife my kids and my underpants. It worked in the end. What nobody emphasizes, though, is that the mysql connection is utf8 whereas everything else is utf-8 -- BIG difference. On 30 Maig, 18:26, "b logica" <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] > > Is that an actual example? That's not escaped at all. It appears to me > to be the result of MySQL's circus-from-hell when working with UTF-8 > strings. Search online for "mysql utf8" and you'll get *a lot* of hits > about this. One needs to ensure that: > > a) the client connection (Cake) tells MySQL to use UTF-8 (database.php); > b) the database was created with UTF-8 encoding (DEFAULT CHARACTER SET); > c) the data was originally inserted as UTF-8 (PHPMyAdmin, i'm looking at > you!); > d) Cake is serving the pages as UTF-8 > > Depending on one's access to the database in question c can be > somewhat of a pain in the arse to figure out. For instance, PHPMyAdmin > might be part of the problem. If you're using that, check the headers > that the server is sending and then check the source to inspect how > the form is being sent back to the server. I can't remember where I > found it, but there is a configuration option for PHPMyAdmin to handle > everything as UTF-8. > > If you're using any text files to insert the data, make sure they > begin with "SET NAMES 'utf8';" > > If you can, connect to the database through a terminal and have a look > at some of these values (the exact ones you're seeing this problem > with). > > On Fri, May 30, 2008 at 10:20 AM, leo <[EMAIL PROTECTED]> wrote: > > > On 30 Maig, 16:06, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > >> If you keep everything UTF-8 from start to finish you actually > >> shouldn't have this problem. > > > On this project, everything is UTF-8 including db etc. That solved the > > problem, but on an earlier project we had to use iso-8859-1. It was > > the only way to get the rss feed displaying properly. On the project, > > the db was, historically, latin1-spanish and I didn't want to change > > it. > > > Having said all that, there are still occasions when not-escaping is > > required, for instance when html entities are stored in po files. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: escaping values in $form->input
> [EMAIL PROTECTED] Is that an actual example? That's not escaped at all. It appears to me to be the result of MySQL's circus-from-hell when working with UTF-8 strings. Search online for "mysql utf8" and you'll get *a lot* of hits about this. One needs to ensure that: a) the client connection (Cake) tells MySQL to use UTF-8 (database.php); b) the database was created with UTF-8 encoding (DEFAULT CHARACTER SET); c) the data was originally inserted as UTF-8 (PHPMyAdmin, i'm looking at you!); d) Cake is serving the pages as UTF-8 Depending on one's access to the database in question c can be somewhat of a pain in the arse to figure out. For instance, PHPMyAdmin might be part of the problem. If you're using that, check the headers that the server is sending and then check the source to inspect how the form is being sent back to the server. I can't remember where I found it, but there is a configuration option for PHPMyAdmin to handle everything as UTF-8. If you're using any text files to insert the data, make sure they begin with "SET NAMES 'utf8';" If you can, connect to the database through a terminal and have a look at some of these values (the exact ones you're seeing this problem with). On Fri, May 30, 2008 at 10:20 AM, leo <[EMAIL PROTECTED]> wrote: > > On 30 Maig, 16:06, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: >> If you keep everything UTF-8 from start to finish you actually >> shouldn't have this problem. > > On this project, everything is UTF-8 including db etc. That solved the > problem, but on an earlier project we had to use iso-8859-1. It was > the only way to get the rss feed displaying properly. On the project, > the db was, historically, latin1-spanish and I didn't want to change > it. > > Having said all that, there are still occasions when not-escaping is > required, for instance when html entities are stored in po files. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: escaping values in $form->input
On 30 Maig, 16:06, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > If you keep everything UTF-8 from start to finish you actually > shouldn't have this problem. On this project, everything is UTF-8 including db etc. That solved the problem, but on an earlier project we had to use iso-8859-1. It was the only way to get the rss feed displaying properly. On the project, the db was, historically, latin1-spanish and I didn't want to change it. Having said all that, there are still occasions when not-escaping is required, for instance when html entities are stored in po files. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: escaping values in $form->input
If you keep everything UTF-8 from start to finish you actually shouldn't have this problem. That means database tables and fields in UTF-8, your PHP files in UTF-8 for any possibly hardcoded strings and a proper HTML meta-tag in your sites denoting UTF-8. I'm working a lot with Japanese and come across the odd accent and never had a problem with that. On 30 May 2008, at 17:24, leo wrote: > > On 28 Maig, 06:31, jeff aigner <[EMAIL PROTECTED]> wrote: >> Could you be a little more clear. I'm not sure what "escaping values >> in $form->input" really means. > > What I mean is that, by default, most Cake functions escape strings > before outputting them. This means that accentuation and punctuation, > not considered to be 'normal' by the American Standards Association, > now the American National Standards Institute, is displayed as > unexpected 'escape' characters so that you might get '[EMAIL PROTECTED]' > when what you were looking for was prèsencia. > > At times this escaping is essential to prevent interaction with the > host language(s) and/or database. At other times, however, it is > undesirable. To this end, a lot of Cake functions are equipped with > the option to 'turn off' escaping - the fifth parameter to $html->link > is an example. Others don't seem to have this option. Part of the > problem is that (without criticism) Cake, like many other systems, has > developed so fast that standardisation of approach has lagged and, > where in one function you might add false as a parameter, viz: $html- >> link('blah', 'http://example.com','stuff',null,false,null) in another > it might be specified as an element in the 'options' array, viz: > array('escape'=>false,'label'=>'my label' ). > > Sorry to be so long winded, buut it's a Friday. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: escaping values in $form->input
On 28 Maig, 08:08, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote: > If you mean "escaping to HTML entities", just override the automatic > value: > > $form->input('nacionalitat', array('value' => html_entities($this- > >data['User']['nacionalitat']))); Thanks, I'll try that when I come back round to this part of the dev. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: escaping values in $form->input
On 28 Maig, 06:31, jeff aigner <[EMAIL PROTECTED]> wrote: > Could you be a little more clear. I'm not sure what "escaping values > in $form->input" really means. What I mean is that, by default, most Cake functions escape strings before outputting them. This means that accentuation and punctuation, not considered to be 'normal' by the American Standards Association, now the American National Standards Institute, is displayed as unexpected 'escape' characters so that you might get '[EMAIL PROTECTED]' when what you were looking for was prèsencia. At times this escaping is essential to prevent interaction with the host language(s) and/or database. At other times, however, it is undesirable. To this end, a lot of Cake functions are equipped with the option to 'turn off' escaping - the fifth parameter to $html->link is an example. Others don't seem to have this option. Part of the problem is that (without criticism) Cake, like many other systems, has developed so fast that standardisation of approach has lagged and, where in one function you might add false as a parameter, viz: $html- >link('blah', 'http://example.com','stuff',null,false,null) in another it might be specified as an element in the 'options' array, viz: array('escape'=>false,'label'=>'my label' ). Sorry to be so long winded, buut it's a Friday. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: escaping values in $form->input
If you mean "escaping to HTML entities", just override the automatic value: $form->input('nacionalitat', array('value' => html_entities($this- >data['User']['nacionalitat']))); I don't think there's an escape function built into the form helper, but I could be wrong. On 27 May 2008, at 18:22, leo wrote: > > Is there a way to do this, yet? > > I have tried: >echo $form->input('nacionalitat', array('escape'=>false,'options'=> > $nacionalitats )); > > Doesn't work, though. > > L > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: escaping values in $form->input
Could you be a little more clear. I'm not sure what "escaping values in $form->input" really means. On May 27, 4:22 am, leo <[EMAIL PROTECTED]> wrote: > Is there a way to do this, yet? > > I have tried: > echo $form->input('nacionalitat', array('escape'=>false,'options'=> > $nacionalitats )); > > Doesn't work, though. > > L --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---