Friday, December 21, 2012

interesting utf-8 issue

Hi bakers,

so piggy backing off of this https://groups.google.com/forum/#!searchin/cake-php/utf$208/cake-php/ERyfps6CRyQ/oBr_ngD600kJ

I noticed something weird in my encoding for a cake 2.2.2 app.

Basically in the database config it is set to utf-8
in the header of the default layout it is set to utf-8 with the $this->html->charset();  and in view source it comes as utf 8
at the top of bootstrap I added header('Content-Type: text/html; charset=utf-8'); as per another problem another user had which fixed theirs but still no luck

But here is the issue...

when there are special characters being placed on the screen THEY ARE FINE!  when using all methods of the html helper, THEY ARE FINE...EXCEPT...when I use $this->Html->link('$label', array('controller' => '#', 'action' => '#'));

when using the link method ONLY special characters come out exactly as they are and not encoded as how I have the screen set. Even when I take the exact same thing from the $label and post it on the page it renders fine...it only happens on that one method in the link helper.

so I used the option modifier array(escape = false) at the end of the html helper call and it worked fine, but this would mean I have to do this for every link that was made on the entire application.

Is there another way to do this that I am overlooking?  can cake just detect that the charset / encoding setting is and use that instead of having to make escape false on all the links?

(and without modifying the core helper, if we can help it)

Thanks.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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 cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: