Sunday, July 28, 2013

Re: Themed Views & Unicode

A very strange thing happened. I was trying to debug the code to find the root of the problem. I put debug(trace) statements in index.ctp. I then inserted debug statements in several lib files. I could not trace the problem. I then thought of inserting debug statement in the Controller. I did that and it did not work. I deleted the debug statement and saved the controller file. 

It worked! Now I am able to see Unicode properly.

Can't explain this. I, for some time, thought that the controller had to be 'touched' once to make things work. But that is not true too. For I had changed the controller file earlier, in order to make some changes to the Theme related statements.

The unicode displays properly only if I comment the themed statements and run the raw cakephp View. If I add the theme, the application behaves just like before.

Crazy. 

I also noticed that in the gedit, there is another combo next to character encoding, by the name line ending. Many of my files have this value as Windows. Is this affecting the behaviour? 

Regards,
Harish


On 24 July 2013 19:34, Harish Amur <harishamur@gmail.com> wrote:

On 24 July 2013 05:46, lowpass <zijn.digital@gmail.com> wrote:
cat /var/lib/locales/supported.d/local 
cat /etc/default/locale 
 
PC:~$ cat /var/lib/locales/supported.d/local 
en_IN UTF-8
en_US.UTF-8 UTF-8
PC:~$ cat /etc/default/locale 
LANG="en_IN"
LANGUAGE="en_IN:en"
I also checked the formats of all the files in the View folder. They are either UTF-8 or ascii. 

Thank you so much for helping me.

I also wrote a simple html file with unicode characters. It is working fine. In fact, in the page that cakephp renders, the data retrieved from database is being shown properly. So it is not the environment, for sure.

I feel this - the cake programs are not building the View properly. I even tried to dig through the 'lib' code to find out where this problem could be. It will take me days to understand this code :(

I will try installing these in a windows environment and check if it works. But, that may take a couple of days.

Thank you once again.

Regards,
Harish

PS: In cake 1.x, if I the controller file was made UTF-8, cake would throw a 'headers not sent' kind of an error and not work. So, I assumed that controller files can only be ascii format.


--
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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: