X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gedcom%2Fencoding.c;h=1cae728808f5c8dfd9f9cf6556f4c575a20e78dd;hb=398a39079768a8f3d12180b2012bdd1dd5675213;hp=e0140b2f1dff7d32e24743748f10b42004d74f21;hpb=4c78192cf17bde2f3c6bff7bb90757c21d1e3792;p=gedcom-parse.git diff --git a/gedcom/encoding.c b/gedcom/encoding.c index e0140b2..1cae728 100644 --- a/gedcom/encoding.c +++ b/gedcom/encoding.c @@ -28,14 +28,14 @@ #include "gedcom_internal.h" #include "gedcom.h" #include "encoding.h" +#include "encoding_state.h" #include "hash.h" -#include "utf8.h" +#include "utf8tools.h" #define ENCODING_CONF_FILE "gedcom.enc" #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);