Re: strtolower utf-8 char problem
Hello, Thanks for your interest Felix. As you said encoding and decoding the characters in UTF-8 does not solve the problem. Also, charset and header issues don't solve it alone. Furthermore, multibyte string methods works well for utf-8 encoding. Since my database is setted to UTF-8, it looks like working well for now both inputs and outputs. Regards, bt On Oct 30, 7:26 am, Felix Geisendörfer <[EMAIL PROTECTED]> wrote: > Hi, > > UTF-8 supports Umlaute laut "äüö" and french notations like "ç". I know > that for sure. > > I investigated on the problem, and in order to make sure we are on the > same page, this is how my test setup looked like: > - The PHP document I used to test was UTF-8 encoded > - The html document that was served by the php document was treated as > UTF-8 by the browser > > Then I typed in and got the same > results as you. However something like this worked: utf8_encode(strtolower(utf8_decode('ÜÜÜ'))); ?>. The best, and probably > propper solution for the problem I came across was this: mb_strtolower('ÜÜÜ', 'UTF-8') ?>. > > I think this behavior makes total sense given that the normal php string > functions can't deal with utf8 characters. Now the reason it worked with > your non-php document was probably been that it has been treated as you > OS native ISO entirely (php document, and web document). > > When working with UTF-8 in CakePHP you should always pay attention to > the following things: > 1. All PHP documents you use Umlaute, or other utf8 characters in must > be encoded UTF-8 themselves > 2. The html document must be served as utf-8. > 3. The database connection needs to be UTF-8. > > For number #2 put this line on top of your layout view (i.e. default.thtml): > > > And this in your section: > charset('UTF-8'); ?> > > To ensure #3 is working, use this code in your AppModel: > class AppModel extends Model > { > function __construct($id = null, $table = null, $ds = null) > { > parent::__construct($id, $table, $ds); > > if (!defined('MYSQL_SET_NAMES_UTF8') && $this->useTable!==false) > { > @$this->execute("SET NAMES 'UTF8'"); > define('MYSQL_SET_NAMES_UTF8', true); > } > } > > }Good luck and let me know how things are working out. > > Best Regards, > Felix Geisendörfer > --http://www.thinkingphp.orghttp://www.fg-webdesign.de > > Ismael S. Kafeltz schrieb: > > > Try to set you codification on firefox/IE to ISO-8859-1 > > > UTF-8 i guess don't suport this kind of chars äëïöüç > > > does this helps? > > > > instead of UTF-8 ? > > > and/or > > header('Content-Type:text/plain;charset=iso-8859-1'); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: strtolower utf-8 char problem
Hi, UTF-8 supports Umlaute laut "äüö" and french notations like "ç". I know that for sure. I investigated on the problem, and in order to make sure we are on the same page, this is how my test setup looked like: - The PHP document I used to test was UTF-8 encoded - The html document that was served by the php document was treated as UTF-8 by the browser Then I typed in and got the same results as you. However something like this worked: . The best, and probably propper solution for the problem I came across was this: . I think this behavior makes total sense given that the normal php string functions can't deal with utf8 characters. Now the reason it worked with your non-php document was probably been that it has been treated as you OS native ISO entirely (php document, and web document). When working with UTF-8 in CakePHP you should always pay attention to the following things: 1. All PHP documents you use Umlaute, or other utf8 characters in must be encoded UTF-8 themselves 2. The html document must be served as utf-8. 3. The database connection needs to be UTF-8. For number #2 put this line on top of your layout view (i.e. default.thtml): And this in your section: charset('UTF-8'); ?> To ensure #3 is working, use this code in your AppModel: class AppModel extends Model { function __construct($id = null, $table = null, $ds = null) { parent::__construct($id, $table, $ds); if (!defined('MYSQL_SET_NAMES_UTF8') && $this->useTable!==false) { @$this->execute("SET NAMES 'UTF8'"); define('MYSQL_SET_NAMES_UTF8', true); } } } Good luck and let me know how things are working out. Best Regards, Felix Geisendörfer -- http://www.thinkingphp.org http://www.fg-webdesign.de Ismael S. Kafeltz schrieb: Try to set you codification on firefox/IE to ISO-8859-1 UTF-8 i guess don't suport this kind of chars äëïöüç does this helps? instead of UTF-8 ? and/or header('Content-Type:text/plain;charset=iso-8859-1'); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: strtolower utf-8 char problem
Try to set you codification on firefox/IE to ISO-8859-1 UTF-8 i guess don't suport this kind of chars äëïöüç does this helps? instead of UTF-8 ? and/or header('Content-Type:text/plain;charset=iso-8859-1'); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: strtolower utf-8 char problem
No thanks, my problem is not related with php. I said that function works properly in php files outside the cakephp framework however it doesn't work in cakephp framework. The problem is directly related to cakephp encoding issues. Though I have tried some charset issues but didn't work. Do you have any suggestions? or has anyone came across with the same problem on utf8 encoding? Thanks. On Oct 29, 11:56 pm, "Ismael S. Kafeltz" <[EMAIL PROTECTED]> wrote: > I think your problem is with php details, you should try to solve this > problem in specific php language, i believe you will find the solution > quickly. > > http://groups.google.com/group/Professional-PHP?lnk=li --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
Re: strtolower utf-8 char problem
I think your problem is with php details, you should try to solve this problem in specific php language, i believe you will find the solution quickly. http://groups.google.com/group/Professional-PHP?lnk=li --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---
strtolower utf-8 char problem
Hi all, strtolower() function does not work properly in my cakephp applications however it works other standalone php files in the same server. When I try to change a character to lowercase, some special chars replaces with question marks. I tried both setting & printing out in view file and setting in controller file & printing in view file. it prints ??? however it should be üüü. it works outside of the cakephp. What can be the problem? I searched but couldn't find the exact solution. Thanks, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~--~~~~--~~--~--~---