Just a follow up on this issue.
If i use CSV files Your module then accepts Charset Name: ISO-8859-1 setting in the module and displays data correct in the tables.
But I am using table data from a MS SQL 2008 server in Danish correlation and in the ARI Data Table the national Danish characters "æøåÆØÅ" does not show correct.
My own solution is to add two functions into the file: modules\mod_aridatatables\includes\kernel\DataTables\Models\class.DataTablesDataSqlModel.php
<?php
/*
* ARI Data Tables
*
* @package ARI Data Tables
* @version 1.0.0
* @author ARI Soft
* @copyright Copyright (c) 2010
www.ari-soft.com. All rights reserved
* @license GNU/GPL (
www.gnu.org/copyleft/gpl.html)
*
*/
function check_utf8($string) {
return preg_match('%^(?:
[\x09\x0A\x0D\x20-\x7E] # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
)*$%xs', $string);
}
function encode_items(&$item, $key)
{
if(!check_utf8($item)) {
$item = utf8_encode($item);
}
}
defined('ARI_FRAMEWORK_LOADED') or die('Direct Access to this location is not allowed.');
__________________________
. . . .
__________________________
global $ADODB_FETCH_MODE;
$query = $this->prepareQuery($params['query']);
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$data = $conn->GetArray($query);
array_walk_recursive($data, 'encode_items');
if ($conn->ErrorNo())
{
$data = null;
}
if ($conn && $conn->IsConnected())
$conn->Close();
return $data;
}
Above i call the function
array_walk_recursive($data, 'encode_items'); and this works and is fine. I have to modify every time the module is updated and that is not a problem for me.
BUT
I guess many other people (Scandinavia / Germany e.t.c.) have similar correlation issues and I have ask that You consider the following:
1) Will this hack-fix make the module unstable or cause malfunction. I have not noticed problems - maybe one thing: Hidden Columns does not to work.
2) Maybe You take this to future enhancment and implement this using the module parameter "Charset Name"!
Sincerely Johnny Ejs