Re: - Problem with Ajax and encoding

2008-06-16 Thread Webrickco

Thanks to Spark and AD7six for their kind help. I figured it out (big
part of the problem was in my local httpd.conf file). Let me just make
a summary so that everybody keep in mind when dealing with UTF-8
encoding:

How to display Portuguese encoding or general UTF8 encoding in Cake or
dynamic programming. Check that you have the following elements:

•httpd.conf: AddDefaultCharset UTF-8,

•Files must be saved with UTF-8 format (all your previous special
character are now unreadable and must be rewritten),

•Default.ctp: echo $html-charset('UTF-8'); (equivalent to meta http-
equiv=Content-Type content=text/html; charset=UTF-8 /),

•Headers should also display: html xmlns=http://www.w3.org/1999/
xhtml xml:lang=pt lang=pt dir=ltr

•Database should be configured as utf8_unicode_ci for both tables and
fields.

That should work!

On 15 Jun, 17:56, Webrickco [EMAIL PROTECTED] wrote:
 Thx for your kind answers.

 The point is that everything looks fine locally and when i put
 everything on the server the Ajax request fail to present data
 properly, however requests to the database and HTML presentation
 continue to work fine in ISO-8859-1, and unfortunately not in UTF-8.

 I would believe this is a server configuration issue and will follow
 your recommendation on that matter.

 On 15 Jun, 15:49, Spark [EMAIL PROTECTED] wrote:



  database default collation is just a little part, and doesn't matter
  as much as you may think.
  database connection is far more important (you can change it in
  config/database.php), the file you are editing is, i'm almost for
  sure, wrongly encoded. Try To change it in Aptana or Eclipse (under
  the 'edit' menu, there's a 'set encoding' option. It's the most common
  mistake when dealing with utf8. Another sensitive part is the *server*
  configurations for sending text/html. Some of very old or badly
  configured servers lack the possibility to send it in utf8, therefore,
  breaking the path between cake and the browser.

  This is *the* article to read. It helped me a thousand times when
  dealing with 'i dont need to know this' 
  programmers:http://www.joelonsoftware.com/articles/Unicode.html

  Spark

  On Sun, Jun 15, 2008 at 6:33 AM, Webrickco [EMAIL PROTECTED] wrote:

   Hi, I have a problem figuring out why the result of an Ajax execution
   is not in the correct encoding under cake.

   You can see the result athttp://webrickco.com/caketest. Using the
   user/password david/test and clicking on the first link: Alterar a
   configuração dos menus. At this point the result of the consultation
   to the database is correctly displayed as well as all other
   accentuated text in the page, but if I click on a tick button (calls
   an Ajax function to copy the values to the edit fields and refreshes
   the item list), the refresh of the DIV is compromised. How do i do to
   keep the correct encoding after I fire an Ajax function?

   Some data on the site:
   Default.ctp: $html-charset('ISO-8859-1');

   Ajax function triggered as follow:
   echo td.$ajax-submit('tick.png', array('update' = 'tabela',
   'loaded' = Effect.BlindDown(\'tabela\')', 'url' = '/menus/update/'.
   $menu['Menu']['id']./.$menu['Menu']['description']./.$menu['Menu']
   ['link']))./td;

   Database fields and tables are kept in utf8_general_ci encoding by
   default

   Thx for your help.

  --
  [livesets]http://djspark.com.br/
  [web]http://sydi.net
  [filmes]http://melhoresfilmes.com.br- Ocultar texto citado -

 - Mostrar texto citado -

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



[Cake 1.2. RC1] - Problem with Ajax and encoding

2008-06-15 Thread Webrickco

Hi, I have a problem figuring out why the result of an Ajax execution
is not in the correct encoding under cake.

You can see the result at http://webrickco.com/caketest. Using the
user/password david/test and clicking on the first link: Alterar a
configuração dos menus. At this point the result of the consultation
to the database is correctly displayed as well as all other
accentuated text in the page, but if I click on a tick button (calls
an Ajax function to copy the values to the edit fields and refreshes
the item list), the refresh of the DIV is compromised. How do i do to
keep the correct encoding after I fire an Ajax function?

Some data on the site:
Default.ctp: $html-charset('ISO-8859-1');

Ajax function triggered as follow:
echo td.$ajax-submit('tick.png', array('update' = 'tabela',
'loaded' = Effect.BlindDown(\'tabela\')', 'url' = '/menus/update/'.
$menu['Menu']['id']./.$menu['Menu']['description']./.$menu['Menu']
['link']))./td;

Database fields and tables are kept in utf8_general_ci encoding by
default

Thx for your help.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Cake 1.2. RC1 - Problem with Ajax and encoding

2008-06-15 Thread Webrickco

Hi,

I have a test page made with cake 1.2 RC1 and everything is fine
despite the lack of documentation on the matter. I have however a
little problem on my production site that doesn't happen on local. The
problem is with encoding. Everything looks fine until i fire an event
calling Ajax and returning a result refreshing a DIV. At that point,
the DIV gets a bad encoding. Why is that?

You can see the result at http://www.webrickco.com/caketest.
User/password: david/test
First option: Alterar a configuração dos menus
Then just click on a Tick to see how the list will be messed up.

Some more data:
Default.ctp: $html-charset('ISO-8859-1');

Database codepage: utf8_general_ci

Ajax call:
echo td.$ajax-submit('tick.png', array('update' = 'tabela',
'loaded' = 'Effect.BlindDown(\'tabela\')', 'url' = '/menus/update/'.
$menu['Menu']['id']./.$menu['Menu']['description']./.$menu['Menu']
['link']))./td;

Thanks in advance. Your help is much appreciated.
David

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: - Problem with Ajax and encoding

2008-06-15 Thread AD7six



On Jun 15, 11:33 am, Webrickco [EMAIL PROTECTED] wrote:
 Hi, I have a problem figuring out why the result of an Ajax execution
 is not in the correct encoding under cake.

because you are not using UTF-8, ajax requests always use and expect
UTF-8.

 You can see the result athttp://webrickco.com/caketest. Using the
 user/password david/test and clicking on the first link: Alterar a
 configuração dos menus. At this point the result of the consultation
 to the database is correctly displayed as well as all other
 accentuated text in the page, but if I click on a tick button (calls
 an Ajax function to copy the values to the edit fields and refreshes
 the item list), the refresh of the DIV is compromised. How do i do to
 keep the correct encoding after I fire an Ajax function?

By making everything UTF-8.

 Some data on the site:
 Default.ctp: $html-charset('ISO-8859-1');

Why.

 Ajax function triggered as follow:
 echo td.$ajax-submit('tick.png', array('update' = 'tabela',
 'loaded' = Effect.BlindDown(\'tabela\')', 'url' = '/menus/update/'.
 $menu['Menu']['id']./.$menu['Menu']['description']./.$menu['Menu']
 ['link']))./td;

 Database fields and tables are kept in utf8_general_ci encoding by
 default

Double why (are you mixing encodings - that's a recipe for disaster)

For info:
http://groups.google.com/group/cake-php/browse_thread/thread/28f129e2d31ea263/c64b63942d68cc87?lnk=gstq=pr%3Fblems#c64b63942d68cc87


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake 1.2. RC1 - Problem with Ajax and encoding

2008-06-15 Thread AD7six



On Jun 15, 12:13 pm, Webrickco [EMAIL PROTECTED] wrote:
 Hi,

 I have a test page made with cake 1.2 RC1 and everything is fine
 despite the lack of documentation on the matter.

book.cakephp.org

 I have however a
 little problem on my production site that doesn't happen on local. The
 problem is with encoding. Everything looks fine until i fire an event
 calling Ajax and returning a result refreshing a DIV. At that point,
 the DIV gets a bad encoding. Why is that?

No double posting please.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: - Problem with Ajax and encoding

2008-06-15 Thread Webrickco

Thank for your answer. I was expecting you say something like this.
Obviously i tryed UTF-8 as first place along with many other
configuration of charset. Unfortunately, if i put $html-
charset('UTF-8'); you can look at the result now at 
http://www.webrickco.com/caketest

It's even worse!!! This time, no encoding is working: html, database
and sure Ajax requests...


On 15 Jun, 12:26, AD7six [EMAIL PROTECTED] wrote:
 On Jun 15, 11:33 am, Webrickco [EMAIL PROTECTED] wrote:

  Hi, I have a problem figuring out why the result of an Ajax execution
  is not in the correct encoding under cake.

 because you are not using UTF-8, ajax requests always use and expect
 UTF-8.

  You can see the result athttp://webrickco.com/caketest. Using the
  user/password david/test and clicking on the first link: Alterar a
  configuração dos menus. At this point the result of the consultation
  to the database is correctly displayed as well as all other
  accentuated text in the page, but if I click on a tick button (calls
  an Ajax function to copy the values to the edit fields and refreshes
  the item list), the refresh of the DIV is compromised. How do i do to
  keep the correct encoding after I fire an Ajax function?

 By making everything UTF-8.

  Some data on the site:
  Default.ctp: $html-charset('ISO-8859-1');

 Why.

  Ajax function triggered as follow:
  echo td.$ajax-submit('tick.png', array('update' = 'tabela',
  'loaded' = Effect.BlindDown(\'tabela\')', 'url' = '/menus/update/'.
  $menu['Menu']['id']./.$menu['Menu']['description']./.$menu['Menu']
  ['link']))./td;

  Database fields and tables are kept in utf8_general_ci encoding by
  default

 Double why (are you mixing encodings - that's a recipe for disaster)

 For 
 info:http://groups.google.com/group/cake-php/browse_thread/thread/28f129e2...

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: - Problem with Ajax and encoding

2008-06-15 Thread AD7six



On Jun 15, 3:20 pm, Webrickco [EMAIL PROTECTED] wrote:
 Thank for your answer. I was expecting you say something like this.
 Obviously i tryed UTF-8 as first place along with many other
 configuration of charset. Unfortunately, if i put $html-

 charset('UTF-8'); you can look at the result now 
 athttp://www.webrickco.com/caketest

It's a bit pointless changing the charset tag if what you are sending
doesn't match it.

If the text Página para testar os ãõíúáéç comes from a view file -
your view files are ISO-8859-1 encoded.

You need to check
 the encoding of your view files
 your db connection encoding
 your db table encoding
 your meta tag

You should delete anything put in the db with your 'exotic' charset
setup because it will give you pr?blems.

And if you are still getting pr?blems there are 2 possibilities
 You still have something to check/correct
 See point one.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: [Cake 1.2. RC1] - Problem with Ajax and encoding

2008-06-15 Thread Spark

database default collation is just a little part, and doesn't matter
as much as you may think.
database connection is far more important (you can change it in
config/database.php), the file you are editing is, i'm almost for
sure, wrongly encoded. Try To change it in Aptana or Eclipse (under
the 'edit' menu, there's a 'set encoding' option. It's the most common
mistake when dealing with utf8. Another sensitive part is the *server*
configurations for sending text/html. Some of very old or badly
configured servers lack the possibility to send it in utf8, therefore,
breaking the path between cake and the browser.

This is *the* article to read. It helped me a thousand times when
dealing with 'i dont need to know this' programmers:
http://www.joelonsoftware.com/articles/Unicode.html

Spark

On Sun, Jun 15, 2008 at 6:33 AM, Webrickco [EMAIL PROTECTED] wrote:

 Hi, I have a problem figuring out why the result of an Ajax execution
 is not in the correct encoding under cake.

 You can see the result at http://webrickco.com/caketest. Using the
 user/password david/test and clicking on the first link: Alterar a
 configuração dos menus. At this point the result of the consultation
 to the database is correctly displayed as well as all other
 accentuated text in the page, but if I click on a tick button (calls
 an Ajax function to copy the values to the edit fields and refreshes
 the item list), the refresh of the DIV is compromised. How do i do to
 keep the correct encoding after I fire an Ajax function?

 Some data on the site:
 Default.ctp: $html-charset('ISO-8859-1');

 Ajax function triggered as follow:
 echo td.$ajax-submit('tick.png', array('update' = 'tabela',
 'loaded' = Effect.BlindDown(\'tabela\')', 'url' = '/menus/update/'.
 $menu['Menu']['id']./.$menu['Menu']['description']./.$menu['Menu']
 ['link']))./td;

 Database fields and tables are kept in utf8_general_ci encoding by
 default

 Thx for your help.

 




-- 
[livesets] http://djspark.com.br/
[web] http://sydi.net
[filmes] http://melhoresfilmes.com.br

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: - Problem with Ajax and encoding

2008-06-15 Thread Webrickco

Thx for your kind answers.

The point is that everything looks fine locally and when i put
everything on the server the Ajax request fail to present data
properly, however requests to the database and HTML presentation
continue to work fine in ISO-8859-1, and unfortunately not in UTF-8.

I would believe this is a server configuration issue and will follow
your recommendation on that matter.

On 15 Jun, 15:49, Spark [EMAIL PROTECTED] wrote:
 database default collation is just a little part, and doesn't matter
 as much as you may think.
 database connection is far more important (you can change it in
 config/database.php), the file you are editing is, i'm almost for
 sure, wrongly encoded. Try To change it in Aptana or Eclipse (under
 the 'edit' menu, there's a 'set encoding' option. It's the most common
 mistake when dealing with utf8. Another sensitive part is the *server*
 configurations for sending text/html. Some of very old or badly
 configured servers lack the possibility to send it in utf8, therefore,
 breaking the path between cake and the browser.

 This is *the* article to read. It helped me a thousand times when
 dealing with 'i dont need to know this' 
 programmers:http://www.joelonsoftware.com/articles/Unicode.html

 Spark



 On Sun, Jun 15, 2008 at 6:33 AM, Webrickco [EMAIL PROTECTED] wrote:

  Hi, I have a problem figuring out why the result of an Ajax execution
  is not in the correct encoding under cake.

  You can see the result athttp://webrickco.com/caketest. Using the
  user/password david/test and clicking on the first link: Alterar a
  configuração dos menus. At this point the result of the consultation
  to the database is correctly displayed as well as all other
  accentuated text in the page, but if I click on a tick button (calls
  an Ajax function to copy the values to the edit fields and refreshes
  the item list), the refresh of the DIV is compromised. How do i do to
  keep the correct encoding after I fire an Ajax function?

  Some data on the site:
  Default.ctp: $html-charset('ISO-8859-1');

  Ajax function triggered as follow:
  echo td.$ajax-submit('tick.png', array('update' = 'tabela',
  'loaded' = Effect.BlindDown(\'tabela\')', 'url' = '/menus/update/'.
  $menu['Menu']['id']./.$menu['Menu']['description']./.$menu['Menu']
  ['link']))./td;

  Database fields and tables are kept in utf8_general_ci encoding by
  default

  Thx for your help.

 --
 [livesets]http://djspark.com.br/
 [web]http://sydi.net
 [filmes]http://melhoresfilmes.com.br

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---