can glib support other character set?



    Hi, all!
    Now I have a wap browser coded in c++, and it uses gtk and gdk functions.Now I want to make the wap 
browser to 
support Chinease.
    I have these questions:
    (1)         string font_str = "-*-helvetica-";
        font_str += bold > 0 ? "bold-" : "medium-";
        font_str += italic > 0 ? "i-" : "r-";
        font_str += "normal--*-*-*-*-*-*-iso8859-1";
            g_print("TextCard::createFont!!");
        font = gdk_font_load(font_str.c_str());
            
            I don't know whether gdk supports other character set , for exemple "utf-8".What should I do to 
support other 
character  other than  iso8859-1?

     (2)  I know there is a function name "g_conver"  in  glib. It is defined as follow:
            gchar*      g_convert                       (const gchar *str,
                                             gint len,
                                             const gchar *to_codeset,
                                             const gchar *from_codeset,
                                             gint *bytes_read,
                                             gint *bytes_written,
                                             GError **error);
 

Convert a string from one character set to another.
str : the string to convert 
len : the length of the string 
to_codeset : name of character set into which to convert str 
from_codeset : character set of str. 
bytes_read : location to store the number of bytes in the input string that were successfully converted, or 
NULL. Even if the conversion was succesful, this may be less than len if there were partial characters at the 
end of the input. If the error G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will the byte fofset 
after the last valid input sequence. 
bytes_written : the stored in the output buffer (not including the terminating nul. 
error : location to store the error occuring, or NULL to ignore errors. Any of the errors in GConvertError 
may occur. 
Returns : If the conversion was successful, a newly allocated NUL-terminated string, which must be freed with 
g_free. Otherwise NULL and error will be set. 


             but when I compile the program, it reports: undefined reference to g_convert.I don't know why?

             thanks in advance!
----------------------------------------------
»¶Ó­Ê¹Óà 21CN µç×ÓÓʼþϵͳ http://www.21cn.com
Thank you for using 21cn.com Email system





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]