X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gedcom%2Fencoding.c;h=1cae728808f5c8dfd9f9cf6556f4c575a20e78dd;hb=10f8650f9b9aa04722c98b165bbee88a4c67cf21;hp=a8780515135006b486f95fc89adf143950d14786;hpb=177218adadc7aa92a1c14e6b8b33080dc77d6e4e;p=gedcom-parse.git diff --git a/gedcom/encoding.c b/gedcom/encoding.c index a878051..1cae728 100644 --- a/gedcom/encoding.c +++ b/gedcom/encoding.c @@ -28,6 +28,7 @@ #include "gedcom_internal.h" #include "gedcom.h" #include "encoding.h" +#include "encoding_state.h" #include "hash.h" #include "utf8tools.h" @@ -35,7 +36,6 @@ #define GCONV_SEARCH_PATH "GCONV_PATH" #define MAXBUF 255 -static Encoding the_enc = ONE_BYTE; static hash_t *encodings = NULL; const char* charwidth_string[] = { "1", "2_HILO", "2_LOHI" }; @@ -244,18 +244,13 @@ void init_encodings() } } -void set_encoding_width(Encoding enc) -{ - the_enc = enc; -} - static convert_t to_int = NULL; static char* error_value = ""; int open_conv_to_internal(const char* fromcode) { convert_t new_to_int = NULL; - const char *encoding = get_encoding(fromcode, the_enc); + const char *encoding = get_encoding(fromcode, read_encoding.width); if (encoding != NULL) { new_to_int = initialize_utf8_conversion(encoding, 1); @@ -269,6 +264,7 @@ int open_conv_to_internal(const char* fromcode) if (to_int != NULL) cleanup_utf8_conversion(to_int); to_int = new_to_int; + set_read_encoding(fromcode, encoding); } return (new_to_int != NULL);