Back to index

php5  5.3.10
Functions
sample.c File Reference
#include <stdio.h>
#include "../mbfl/mbfilter.h"

Go to the source code of this file.

Functions

int main ()
 this is a small sample script to use libmbfl.

Function Documentation

int main ( void  )

this is a small sample script to use libmbfl.

Rui Hirokawa hirok.nosp@m.awa@.nosp@m.php.n.nosp@m.et

this file is encoded in EUC-JP.

Definition at line 11 of file sample.c.

{
       enum mbfl_no_encoding from_encoding, to_encoding;
       enum mbfl_no_language no_language;
       mbfl_buffer_converter *convd = NULL;
       mbfl_string string, result, *ret;
       mbfl_language lang;
       unsigned char input[] = "日本語文字列"; /* EUC-JP kanji string */

       no_language = mbfl_name2no_language("Japanese");
       from_encoding = mbfl_name2no_encoding("EUC-JP");
       to_encoding = mbfl_name2no_encoding("SJIS");

       mbfl_string_init(&string);
       mbfl_string_init(&result);

       string.no_encoding = from_encoding;
       string.no_language = no_language;
       string.val = (unsigned char *)input;
       string.len = strlen(input);

       convd = mbfl_buffer_converter_new(from_encoding, to_encoding, 0);
       ret = mbfl_buffer_converter_feed_result(convd, &string, &result);
       mbfl_buffer_converter_delete(convd);      

       puts(ret->val);
       return 1;
}

Here is the call graph for this function: