Sample Code 174: How to display non English characters in php gtk2 - Part 4 - traditional Chinese on linux?
Written by kksou   
Sunday, 18 February 2007
Problem

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

How to display non English characters in php gtk2 - Part 4 - traditional 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 traditional
    php-gtk.codepage = CP936

    ; note: if CP936 doesn't work, try CP950

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

Sample Code
1   
2   
3   
4   
5   
6   
7   
<?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

  • Note that this is only 70% of the sample code. You have to be a registered member to see the entire sample code. Please login or register.
  • Registration is free and immediate.
  • Have some doubt about the registration? Please read this forum article.
Explanation
  1. You can use chinese characters in any standard php-gtk widgets.

Related Links

User reviews

There are no user reviews yet.

Note: You have to be a registered member to leave a comment. Free registration here.

 
< Prev   Next >

Copyright © 2006-2008. kksou.com. All Rights Reserved