PHP on T R A X
Rapid Application Development Made Easy

Reply to topic
UTF-8 form Problem
warrior_deluxe


Joined: 14 Feb 2007
Posts: 14
Reply with quote
This is project critical for me.
I have a utf-8 website and receive data in utf-8 from a webform.
For example if a user sends 'ä' active record saves

Code:

ä


to the database. What can I do to correct this behavior?
View user's profileSend private message
warrior_deluxe


Joined: 14 Feb 2007
Posts: 14
Reply with quote
Just reviewed active record. I can't find any charset settings while establishing the connection. Maybe this is the point?
View user's profileSend private message
johnpipi


Joined: 15 Dec 2005
Posts: 328
Reply with quote
I looked at the site for MDB2 and found this:
http://oss.backendmedia.com/MDB2/CharacterSet

It seems for most RDBMS there is only 1 setting, which sets the client charset. The database charset is determined when the database/table is setup. Its the job of the client-server combination to convert the charsets at some point. This can be set inside an array dsn using the "charset" key.

So it looks like you should be able to just add charset = utf8 to your database.ini in Trax as below:
Code:

[development]
       phptype = mysql
        database = mydbname
        hostspec = localhost
        username = mydbusername
        password = *******
        persistent = true
        charset = utf8


or you can try to do it manually for mysql before you do anything do this:
$model = new Model;
$model->query("SET NAMES 'utf8'");
$model->find_all(); or whatever you want now.

Also maybe make sure everything is utf8 such as:
httpd.conf:
AddCharset UTF-8 .utf8
AddDefaultCharset UTF-8

php.ini
default_charset = "utf-8"

my.cnf
character-set-server=utf8
default-collation=utf8_unicode_ci

and in your layout file:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

another good link i found is:
http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html

Let me know if how it goes and if it works for you.
View user's profileSend private message
andreas_


Joined: 19 Jan 2009
Posts: 1
Reply with quote
johnpipi wrote:

Code:

[development]
       phptype = mysql
        database = mydbname
        hostspec = localhost
        username = mydbusername
        password = *******
        persistent = true
        charset = utf8


thank you johnpipi, charset = utf8 worked for me to retrieve the utf-8 characters from the db.
View user's profileSend private message
UTF-8 form Problem
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 7 Hours  
Page 1 of 1  

  
  
 Reply to topic