Zand Php Cake Php

Posted by : Melanie Sommer
$form->input('') when database-field contains special characters
Hello,



I have the following problem, I already googled but did not find an

answer although I think it must be a quite common problem:



When adding or editing and inserting a special character in a text

field (for example ä, ö, ü, ², µ, ...) everything seems at first to

work fine. The text is correct in the mysql databse and is displayed

correctly in any view.ctp or index.ctp.



But when trying to edit this entry, that means calling edit.ctp with

"$form->input('title');" the text field containing special characters

simply stays completely empty. So I do not have the problem that the

special characters are displayed wrong, the whole content is simply

not displayed at all.



If it is important my settings are:

app/core.php

Configure::write('App.
encoding', 'UTF-8');

my mysql database collation is latin1_swedish_ci



Thanks for any advise!
 
 
Posted by : Dr. Loboto
Re : $form->input('') when database-field contains special characters
1. App.encoding must be UTF-8 (core.php)

2. Database encoding must be UTF8 (MySQL)

3. Database connection encoding must be UTF8 (database.php)

4. Layout or server settings must define pages encoding as UTF-8 (app/

layouts/default.ctp and etc or Apache AddDefaultCharset)

5. Files with non-latin symbols must be in UTF-8 ecoding without BOM
 
 
Posted by : Martin Westin
Re : $form->input('') when database-field contains special characters
In reference to the bottom f your post. utf-8 and latin1_swedish_ci do

not mix.



Since the field is empty I suspect you may have Sanitize in place, or

some other text cleaner. A simple character set problem should give

you garbage but not empty strings.
 
 
Posted by : Melanie Sommer
Re : $form->input('') when database-field contains special characters
Hello Martin

> Since the field is empty I suspect you may have Sanitize in place, or

> some other text cleaner.

No (not that I know, just the standard content that cakephp gives you

when baking)



> A simple character set problem should give you garbage but not empty strings.

This is also was I thought. But when changing the default settings of

my webhoster from latin1 (iso-something) to utf-8 everything worked

fine. Strange but impressive.
 
 
If you have the better reply, then send it to us. We will display your reply after the approval.
Name : 
Email Id :   
Reply :