X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=standalone.c;fp=standalone.c;h=9c8dc15d2130188daf58d18bc945fa2b93036af0;hb=5c40e570e3bd0f3d7139e4d1e429527400c50133;hp=70a3ac17f80a8bb1a0f60ef811a560a6cfa735e1;hpb=5609cf009e11653fec8314695d9897f9b94204d3;p=gedcom-parse.git diff --git a/standalone.c b/standalone.c index 70a3ac1..9c8dc15 100644 --- a/standalone.c +++ b/standalone.c @@ -25,7 +25,10 @@ #include #include #include +#include +#include #include "gedcom.h" +#include "utf8-locale.h" #define OUTFILE "testgedcom.out" FILE* outfile = NULL; @@ -168,8 +171,11 @@ Gedcom_ctxt source_date_start(Gedcom_ctxt parent, int level, char *tag, void default_cb(Gedcom_ctxt ctxt, int level, char *tag, char *raw_value, int tag_value) { + char *converted = NULL; + if (raw_value) + converted = convert_utf8_to_locale(raw_value); output(0, "== %d %s (%d) %s (ctxt is %d)\n", - level, tag, tag_value, raw_value, (int)ctxt); + level, tag, tag_value, converted, (int)ctxt); } void subscribe_callbacks() @@ -252,6 +258,7 @@ int main(int argc, char* argv[]) exit(1); } + setlocale(LC_ALL, ""); gedcom_set_debug_level(debug_level, NULL); gedcom_set_compat_handling(compat_enabled); gedcom_set_error_handling(mech);