Tuesday, July 23, 2013

Re: Themed Views & Unicode

What about the following?

cat /var/lib/locales/supported.d/local 
cat /etc/default/locale 

Have a look at the page headers using Firebug or something similar. Or just use wget in a terminal:


Look for the line with Content-Type: text/html; charset=XXXXXX

Since controller file cannot have utf-8 encoding ...

Of course it can. It's a text file.

To check all your files at once, cd to the View directory and run this:

find . -type f -exec file --mime {} \; > charsets.txt

Then open charsets.txt and see if anything weird is in there. If you see us-ascii that's ok.

On Mon, Jul 22, 2013 at 11:51 PM, Harish Amur <harishamur@gmail.com> wrote:
Thank you. 

Yes, I did think of that. I did a cat of the files and could see unicode properly. I got

/opt/lampp/htdocs/cake/app/View/Themed/Default/Layouts$ file --mime default.ctp
default.ctp: text/html; charset=utf-8

I have moved to Ubuntu recently. The cakephp 1.x files were written in the Windows environment. So, this was my first suspicion. 

It seems to me that while the cakephp is building the webpage, the unicode characters are not being read/written properly. I did not find any other setting, other than the one in core.php

I will also have to stand corrected, that it is not just the unicode chars in the themed files, but the chars in the view/controller files. Since controller file cannot have utf-8 encoding I am using hash encoding for such chars. 

ex: $this->Session->setflash('&#x0ca8;&#x0cc0;&#x0cb5;&#x0cc1;&#x0020;&#x0ca6;&#x0cbe;&#x0c96;&#x0cb2;&#x0cbf;&#x0cb8;&#x0cbf;&#x0ca6;&#x0020;&#x0cb9;&#x0cca;&#x0cb8;&#x0020;&#x0caa;&#x0cc1;&#x0cb8;&#x0ccd;&#x0ca4;&#x0c95;&#x0cb5;&#x0ca8;&#x0ccd;&#x0ca8;&#x0cc1;&#x0020;&#x0c95;&#x0cbe;&#x0caf;&#x0ccd;&#x0ca6;&#x0cbf;&#x0cb0;&#x0cbf;&#x0cb8;&#x0cb2;&#x0cbe;&#x0c97;&#x0cbf;&#x0ca6;&#x0cc6;&#x002e;&#x0020;&#x0caa;&#x0cc1;&#x0cb8;&#x0ccd;&#x0ca4;&#x0c95;&#x0c97;&#x0cb3;&#x0020;&#x0caa;&#x0c9f;&#x0ccd;&#x0c9f;&#x0cbf;&#x0c97;&#x0cbe;&#x0c97;&#x0cbf;&#x0020;&#x0c87;&#x0cb2;&#x0ccd;&#x0cb2;&#x0cbf;&#x0020;&#x0c95;&#x0ccd;&#x0cb2;&#x0cbf;&#x0c95;&#x0ccd;&#x0020;&#x0cae;&#x0cbe;&#x0ca1;&#x0cbf;&#x002e;');

Even these end up being "?"
Regards,
Harish


Regards,
Harish




On 23 July 2013 06:47, lowpass <zijn.digital@gmail.com> wrote:
What is the output of the following?

file --mime your-theme-file


On Mon, Jul 22, 2013 at 1:42 PM, Harish <harishamur@gmail.com> wrote:
I have developed an application using themes. The app has unicode characters. It works fine in Cakephp 1.x. I have been trying to migrate it to cakephp 2.x and I am facing certain issues. I did a lot of search on google as well as discussions, however could not find any solution.

The problem is that the unicode characters are being displayed as "?". These are unicode characters from the layout files, the controller code, the view code. However the unicode characters fetched from the database are being displayed properly.

I have set the encoding in core to UTF-8 and the encoding in the database config file as utf8.

I am using UBUNTU 12.04, XAMPP (lampp) 1.7.7, cakephp 2.x

Thank you,
Harish

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

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

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

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