Well, I played a little bit with this problem of accented characters tonight as I have reasons to think that solving the problem is not so simple.
My configuration is so that language is French and the encoding that I selected for the manager is Western European (ISO), i.e. iso-8859-1.
What I observed is that the selected encoding (in my case iso-8859-1) is used by MODx to tell the browser which encoding it must use by default to display the page, by using a meta tag :
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
For the manager interface, but not only. Also for the documents that MODx generates.
An interesting behavior that I could observe is the following :
- Accented characters don’t display correctly until I select manually the UTF-8 encoding in the browser.
(This makes me think that I use a language file stored in utf-8.
There is maybe an alternative ressource stored in iso-8859-1.)
- As long as I keep the same encoding in the browser (utf-8), the accented characters stored in the title and in the document content display correctly after saving, and also when a preview of the document is done inside MODx manager.
- When the site is previewed (i.e. opened in a new tab if using Firefox 3) and the page accessed, display problem appears as the <meta> that selects iso-8859-1 is printed in the page header, while the document content is written in utf-8.
To summarize, the text of MODx interface was stored in utf-8 and new documents are also stored in utf-8.
Selecting a différent charset in the Configuration prints this charset in the header of generated documents but does not change the way that characters are stored in the MySQL database which remains in utf-8. Maybe I’m wrong; its my 2 penny worth theory.
As suggested above by one of you, I added
global $database_connection_method;
before
in file dbapi.mysql.class.inc.php, line 80 (i.e. function connect).
This solved the problem of characters that were bad displayed in the title textfield and content area when a document was saved and edited again.
However, I’m not sure if the characters were bad stored or just bad displayed when reediting the document.
The observations above let me think that the storage remains in utf-8 and that it was just a display problem.
The opinion of MODx developpers or other MODx experts would be very useful to better understand what happens.
Thanks.