Posted: Wed Dec 27, 2006 3:52 pm
Unicode suppoert is a must. Dataface is unusable for languages that are not using plain ASCII.
I managed to force Dataface to dusplay unicode data correctly by these changes:
In Dataface_Main_Template.html i altered code to look like this:
I marked three lines of code I inserted. Those set MySQL connection in proper unicode state.
After these changes, Dataface shows table data properly. But it is not all, it still does not support UTF8 in full. Editing still does not work (invalid code is inserted in records). I also guess that any advanced string function would also make a problem when used on unicode string values.
I managed to force Dataface to dusplay unicode data correctly by these changes:
In Dataface_Main_Template.html i altered code to look like this:
- Code: Select all
*}{if !$ENV.APPLICATION_OBJECT->main_content_only}
{define_slot name="html_head"}
{define_slot name="html_title"}{if $ENV.record}{$ENV.record->getTitle()} - {else}{$ENV.table} - {/if}{if $ENV.APPLICATION.title}{$ENV.APPLICATION.title}{else}Dataface Application{/if}{/define_slot}
[/cide]
I actualy forced UTF-8 encoding in document.
In Application.php I altered code to look liek this:
[code]
mysql_select_db( $dbinfo['name'] ) or die("Could not select DB: ".mysql_error($this->_db));
}
if ( !defined( 'DATAFACE_DB_HANDLE') ) define('DATAFACE_DB_HANDLE', $this->_db);
//$res = mysql_query("show tables", $this->_db);
//if ( !$res ){
// trigger_error(mysql_error($this->_db), E_USER_ERROR);
//}
//$this->tableIndex = array();
//while ( $row = mysql_fetch_row($res) ){
// $this->tableIndex[$row[0]] = 1;
//}
//mysql_free_result($res);
note -----> mysql_query("SET NAMES 'utf8'", $this->_db);
note -----> mysql_query("SET CHARACTER SET utf8", $this->_db);
note -----> mysql_query("SET COLLATION_CONNECTION = 'utf8_global_ci'", $this->_db);
if ( !is_array( $conf['_tables'] ) ){
echo "
";
Error reading table information from the config file. Please enter the table information in its own section
of the ini file as follows:
[_tables]
table1 = Table 1 Label
table2 = Table 2 Label
exit;
}
I marked three lines of code I inserted. Those set MySQL connection in proper unicode state.
After these changes, Dataface shows table data properly. But it is not all, it still does not support UTF8 in full. Editing still does not work (invalid code is inserted in records). I also guess that any advanced string function would also make a problem when used on unicode string values.