Non-English characters Archives | phpGrid - PHP Datagrid Create PHP grids in minutes, not hours. Fri, 06 Dec 2024 04:20:27 +0000 en-US hourly 1 CodeProjecthttps://wordpress.org/?v=7.0.3 129966043 Display Non-English Characters https://phpgrid.com/example/display-foreign-language-characters/ Wed, 30 Mar 2011 01:30:59 +0000 http://phpgrid.com/?p=1323 If database is created in charset other than default charset, e.g. “latin1″, some characters may be displayed as “?” in the grid. To properly display non-English characters, such as Spanish, Fresh, or Chinese, in MySQL, PostgreSQL, and Oracle you can define the character set value in ‘DB_CHARSET’ variable in conf.php. In conf.php, set the DB_CHARSET […]

The post Display Non-English Characters appeared first on phpGrid - PHP Datagrid.

]]>
If database is created in charset other than default charset, e.g. “latin1″, some characters may be displayed as “?” in the grid. To properly display non-English characters, such as Spanish, Fresh, or Chinese, in MySQL, PostgreSQL, and Oracle you can define the character set value in ‘DB_CHARSET’ variable in conf.php.

In conf.php, set the DB_CHARSET to the corresponding charsets in your database.

version 6+ (with “PHPGRID_” prefix):

1
2
3
4
5
6
define('PHPGRID_DB_HOSTNAME','hostname'); // database host name
define('PHPGRID_DB_USERNAME', 'username'); // database user name
define('PHPGRID_DB_PASSWORD', 'password'); // database password
define('PHPGRID_DB_NAME', 'sampledb'); // database name
define('PHPGRID_DB_TYPE', 'mysql'); // database type
define('PHPGRID_DB_CHARSET','utf8'); // OPTIONAL. Leave blank to use the default charset

version 5.5.x and below:

1
2
3
4
5
6
define('DB_HOSTNAME','hostname'); // database host name
define('DB_USERNAME', 'username'); // database user name
define('DB_PASSWORD', 'password'); // database password
define('DB_NAME', 'sampledb'); // database name
define('DB_TYPE', 'mysql'); // database type
define('DB_CHARSET','utf8'); // OPTIONAL. Leave blank to use the default charset

Add the Meta element to the HTML head node and set character encoding to UTF-8. Note it’s important that the actual file must also be saved as UTF-8 encoding.

1
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

 

Dealing with Special Characters in SQL Server with Non-English Collation

It is slightly more complicated when using SQL Server collation other than the default English-language (US) “SQL_Latin1_General“, you may have trouble display those non-English characters such as “Löi, cé”.

The methods below is also available on KB. It demonstrate how to display Chinese (BIG5) characters from SQL Server.

In data.php, near line 213 change the following from

1
$data[] = $row[$col_name];

to

1
$data[] = iconv("BIG5", "UTF-8", $row[$col_name]);

– OR –

1
$data[] = mb_convert_encoding($row[$col_name], "UTF-8", "BIG5");

Also in the same file, below comment
“// ******************* execute query finally *****************”

Add the following line

1
$SQL = iconv("UTF-8","BIG5",$SQL);

 

Foreign Characters in PDF export

To export Chinese or other foreign characters, see KB: PDF can not display Chinese character
 

See Live Example!

The post Display Non-English Characters appeared first on phpGrid - PHP Datagrid.

]]>
1323
Locale Setting https://phpgrid.com/example/locale-setting/ Tue, 29 Mar 2011 18:19:45 +0000 http://phpgrid.com/?p=1314 If you are using phpGrid in a language rather English, you may want the datagrid to display appropriate system text used by phpGrid such as “Submit”, “Next”, “Page”, “Find” etc. The language locale files are located in js\src\i18n directory.         12345require_once("/file/path/to/conf.php");   $dg = new phpCtrl\C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $dg->set_locale('fr'); […]

The post Locale Setting appeared first on phpGrid - PHP Datagrid.

]]>
If you are using phpGrid in a language rather English, you may want the datagrid to display appropriate system text used by phpGrid such as “Submit”, “Next”, “Page”, “Find” etc. The language locale files are located in js\src\i18n directory.

 
 
phpGrid Comprehensive Locale Support
 
 

1
2
3
4
5
require_once("/file/path/to/conf.php");  

$dg = new phpCtrl\C_DataGrid("SELECT * FROM orders", "orderNumber", "orders");
$dg->set_locale('fr');        
$dg -> display();

See Live Example!

The post Locale Setting appeared first on phpGrid - PHP Datagrid.

]]>
1314