173. How to display non English characters in php gtk2 - Part 3 - simplied Chinese on linux?

Problem

You want to display simplified Chinese characters in php-gtk2 on linux as shown below:

How to display non English characters in php gtk2 - Part 3 - simplied Chinese on linux?


Solution

  1. Open php.ini (suppose you have installed php-gtk2 in /usr/local/php, the file php.ini is located in the directory /usr/local/php/lib).
  2. Look for any line with codepage. The default is:
  3. php-gtk.codepage = CP1250

  4. Replace with the following:
  5. ;;;;;;;;;;;;;
    ; Code Page ;
    ;;;;;;;;;;;;;

    ; Chinese simplified
    php-gtk.codepage = CP936

  6. If you have installed standard linux, you should be able to display simplified chinese characters now.

Sample Code

1   
2   
3   
4   
5   
6   
8   
9   
10   
11   
12   
<?php
$window = new GtkWindow();
$window->set_size_request(240, 120);
$window->connect_simple('destroy', array('Gtk','main_quit'));

$label = new GtkLabel("php-gtk2 ʾ"); // note 1

$window->add($label);
$window->show_all();
Gtk::main();
?>

Output

As shown above.
 

Add comment


Security code
Refresh