View on GitHub


This is a C library implementing the Cangjie input method.

Below is a trivial example of how to use it:

#include <stdio.h>
#include <cangjie.h>

int main() {
    Cangjie *cj;
    int ret = cangjie_new(&cj, CANGJIE_VERSION_3,
                          CANGJIE_FILTER_BIG5 | CANGJIE_FILTER_HKSCS);
    CangjieCharList *chars;
    CangjieCharList *iter;
    ret = cangjie_get_characters(cj, "d*d", &chars);

    if (ret == CANGJIE_NOCHARS) {
        printf("No chars with code '%s'\n", "d*d");
        return 1;

    iter = chars;

    while (1) {
        if (iter == NULL)

        printf("Char: %s, code: '%s', classic frequency: %d\n",
               iter->c->chchar, iter->c->code, iter->c->frequency);

        iter = iter->next;

    return 0;

For more details, refer to the documentation, either online or the one shipped with this software.

Development happens at, and stable release tarballs can be found in the download section of our website.


This library is based on Wan Leung Wong’s original libcangjie.

In fact, when writing it, we tried to stay close to the original libcangjie API, because Wan Leung had done a pretty good job with it.

However, we felt the need to start afresh for a few reasons:

Nevertheless, this library would probably not exist if Wan Leung hadn’t opened the way, so we feel it is important to give him credit.

Thank you very much Wan Leung!


libcangjie is offered under the terms of the GNU Lesser General Public License, either version 3 or any later version.

We won’t ask you to sign a copyright assignment or any other kind of silly and tedious legal document, so just send us patches and/or pull requests!