Has anyone built a Hebrew language site in MODx?
I see we have right to left support, and other right to left languages like Persian here in the forums, so I guess it will work, but would like to hear from anyone who has done so.
thanks.
-
☆ A M B ☆
- 24,524 Posts
There have been a few; do a search for "hebrew" in the Google Search field above; you’ll find references to the forum posts in the second page of results.
thanks sotwell. Of course, the first thing I did was search the forums for Hebrew, but the results there were pretty mixed up with code snippets and technical pages, and nothing really definitive, so I thought it worthwhile asking.
-
☆ A M B ☆
- 24,524 Posts
As far as I can tell (my Hebrew is horrible and I haven’t done any sites in it yet) it’s not much different than any other language; there are a number of active rtl language users who don’t seem to be having problems once they got the database character set straightened out. The actual Hebrew users that I know of got their sites up and probably aren’t active on the forums.
http://modxcms.com/forums/index.php/topic,12934.0.html
-
☆ A M B ☆
- 24,524 Posts
Ok, now it’s my turn. I finally got a request for a site that will be in Hebrew. Here’s what I’ve got:
The MySQL server is set to latin1. Everything else, database, tables, etc. is set to utf8, with collation of uft8_unicode_ci; the connection charset in config.inc.php is utf8. My browser is set to utf8.
I can enter Hebrew text directly into the database via PHPMyAdmin and it is entered, extracted and displayed correctly in the front-end and in Manager fields. But when I save anything from the Manager, all Hebrew text is entered into the database as ??, even previously properly entered text via PHPMyAdmin that displayed correctly.
I can even create a php file to insert Hebrew text into the database, using the same query MODx does, and it works fine.
Since I can use the same browser to insert Hebrew content into the database with PHPMyAdmin, and it is displayed correctly, the issue is not the browers, the database, or PHP. Something in MODx is messing it up when saving.
After a whole day spent getting a headache over this, It’s time to ask for help.
-
☆ A M B ☆
- 24,524 Posts
Just to see what would happen, I inserted some echo statements just before the insert and update queries in the save processors, and the echo came back just fine, both on the POST values and on the escaped values. Somehow the insert and update queries in MODx are not recognizing the charset settings.
-
☆ A M B ☆
- 24,524 Posts
Another interesting development. I changed line 96 in the dbapi.mysql.class.inc.php file from
@mysql_query("SET CHARACTER SET {$charset}", $this->conn);
to
@mysql_query("SET NAMES {$charset}", $this->conn);
and now it works when editing or creating documents. It still saves as ?? in all the other resources. This includes TVs; it saves as ?? from the TV tab, but editing the TV in a document saves it correctly.
-
☆ A M B ☆
- 24,524 Posts
Got it fixed! This query
show variables like '%%character%%'
showed everything but the server itself set to utf8; the server was set to default to latin1. I got my hosting provider to fix that, and suddenly everything is working just fine. If anybody’s interested, I can go through just what I did to convert the latin1 database and latin1 collation sets to utf8. Actually it was pretty easy; but then this was a new installation without a lot of mixed characters yet.
They just changed a setting in the my.cnf file
character-set-server = utf8
-
MODX Staff
- 10,725 Posts
The only reason SET NAMES would work over SET CHARACTER SET (same thing as the SET SESSION collation_connection stuff) is if your database collation was different than the actual collation on your tables. SET CHARACTER SET automatically sets the session collation_connection to match that of the currently selected database container. Can you confirm or deny that your database collation matches the collation on your tables? If it does not match, changing the database to have the proper collation should fix your problem (if I understand what is going on correctly).