Navigation Menu

Skip to content

Commit

Permalink
mecab: convert error message encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jun 22, 2018
1 parent b050a9c commit 53e29be
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions plugins/tokenizers/mecab.c
Expand Up @@ -25,6 +25,8 @@
#include <groonga.h>
#include <groonga/tokenizer.h>

#include <grn_encoding.h>

#include <mecab.h>

#include <stdlib.h>
Expand Down Expand Up @@ -315,11 +317,17 @@ mecab_create(grn_ctx *ctx)

if (!mecab) {
#ifdef GRN_WITH_BUNDLED_MECAB
GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR,
"[tokenizer][mecab] failed to create mecab_t: %s: "
"mecab_new(\"%s\", \"%s\", \"%s\", \"%s\")",
mecab_global_error_message(),
argv[0], argv[1], argv[2], argv[3]);
{
const char *grn_encoding_rc_file;
grn_encoding_rc_file =
grn_encoding_convert_from_locale(ctx, argv[3], -1, NULL);
GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR,
"[tokenizer][mecab] failed to create mecab_t: %s: "
"mecab_new(\"%s\", \"%s\", \"%s\", \"%s\")",
mecab_global_error_message(),
argv[0], argv[1], argv[2], grn_encoding_rc_file);
grn_encoding_converted_free(ctx, grn_encoding_rc_file);
}
#else /* GRN_WITH_BUNDLED_MECAB */
GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR,
"[tokenizer][mecab] failed to create mecab_t: %s: "
Expand Down

0 comments on commit 53e29be

Please sign in to comment.