Friday, December 21, 2012

Re: interesting utf-8 issue

...of course making my addition of html_entitiy_decode to the $title

On Friday, December 21, 2012 3:08:55 PM UTC-5, Devario Johnson wrote:
For anyone that is trying to do this,

to resolve this, I essentially created a custom helper that extended the html helper, and then aliased it.  Works like a charm.

http://book.cakephp.org/2.0/en/views/helpers.html

"scroll to aliasing"

On Friday, December 21, 2012 3:06:29 PM UTC-5, Devario Johnson wrote:
Hi Cricket, that was just an example.  Not the actual code I was using.

On Friday, December 21, 2012 2:43:57 PM UTC-5, cricket wrote:
Maybe unrelated, but you don't need the single quotes around $label.

On Fri, Dec 21, 2012 at 12:01 PM, Devario Johnson <devar...@gmail.com> wrote:
> 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...@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+u...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

--
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: