A strange problem occurred on a client’s Joomla 1.5 website. When they edited the site from the frontend and typed in a £ sign it appeared as £ when it was saved. However, if the same change was made from the Joomla 1.5 administrators area it saved the character as a £.
Even stranger, originally the site was built on a test server ( I used Akeeba to backup and restore the site to it’s final location) and it worked perfectly before the move. So what had happened to cause this issue?
Spot the difference
I figured that since the original test site worked there must have been something different between the servers that must be causing the problem. I figured that since the issue was related to character encoding I could narrow the issue down to that. After a quick Google search the type of things that were often mentioned was the encoding and database collation.
Database collation
Since I restored the database from a backup I figured that if the database collation within phpMyAdmin was set wrongly the data may have been restored to the database in the wrong format. It would also retain the incorrect setting meaning any new data would be saved in an incompatable format resulting in the issue I was seeing.
I checked via phpMyAdmin and found that some of the tables were set as usc2_swedish_ci instead of utf8_general_ci. I reset them, congratulated myself and did some testing expecting that the issue was resolved. I was a little too quick – it wasn’t!
Server configuration error
If the database was fine this made me think that perhaps it was an issue with the server. I went and did another Google search and found some issues relating to .htaccess. I found a very helpful video which explains some things I could check. The suggestion to add AddDefaultCharset utf-8 to .htaccess looked like I may have found the answer! However once again I found this didn’t solve the problem. Back to the drawing board!
Cache
Another search threw up some more suggestions such as disabling the Joomla cache plugin but this didn’t help. I also checked so see if my Joomla template was set to use a different character set. It wasn’t. I also upgraded JCE to the latest version just in case it was doing something weird. I even found another suggestion that double spaces could cause weird problems but this didn’t apply to my setup.
Problem statement
After thinking about the issue some more I decided to try and clarify what was happening in a bit more detail. I thought having a detailed problem statement might help me isolate the problem and find a solution. So I tried adding a £ sign from the Joomla frontend editor while looking at the database. I found that the data was stored incorrectly in the database which suggest the issue was with the way the data was being written.
Web services
I decided to look at the Joomla Configuration in a bit more detail and under the system tab found a setting that I hadn’t noticed before called “web services”. The tool tip said that it was set to off by default but it may be required for some 3rd party tools to work properly. Since I was using JCE I decided to try switching it on. It didn’t fix the issue but it did allow JCE to display the WYSIWYG layout that had been missing from the front end editor. I felt like I was getting a bit closer to an answer!
Joomla configuration for connection to the database
When I was checking the Joomla configuration I noticed that there were some settings relating to the database under the server tab. I decided to compare these to the test site and noticed something odd. The database type was “mysqli” instead of “mysql”. I removed the extra “i” and saved the configuration and guess what? Yep, it solved the problem!
I have no idea why the database type had changed but the addition of that single character caused some odd behavior. Removing it sorted the issue completely! Maybe it was caused by the backup and restore process in combination with the wrong database collation – causing garbled data in this field to be restored. Or I might have type it in the configuration file by accident.
Regardless of how it happened I hope that someone may find this solution useful!
Did you find this post helpful?
If you found this post helpful please take a moment to tweet, like, or share this article by using the buttons at the top or bottom of this page. I’d really appreciate it. 🙂
Also, if you are feeling extra generous please leave some encouraging feedback in the comments section at the bottom of the page. I love getting feedback from visitors. It encourages me to continue writing useful articles for readers like you.
Thanks for taking the time to read my website! You can find other articles that you might find useful at the bottom of this post. Enjoy!
Leave a Reply