diff --git a/main.cc b/main.cc index 7ccdc48..f1d995c 100644 --- a/main.cc +++ b/main.cc @@ -1,5 +1,25 @@ #include +#include int main(int argc, char * argv[]) { + static OnigEncoding encodings[] = { + ONIG_ENCODING_ASCII, + ONIG_ENCODING_UTF8, + ONIG_ENCODING_UTF16_BE, + ONIG_ENCODING_UTF16_LE, + ONIG_ENCODING_UTF32_BE, + ONIG_ENCODING_UTF32_LE, + }; + int rc = onig_initialize(encodings, sizeof(encodings) / sizeof(encodings[0])); + if (rc != ONIG_NORMAL) + { + OnigErrorInfo einfo; + OnigUChar s[ONIG_MAX_ERROR_MESSAGE_LEN]; + onig_error_code_to_str(s, rc, &einfo); + fprintf(stderr, "Error: %s\n", s); + return 1; + } + + return 0; }