First step to input/output charset handling.

This commit is contained in:
Vreixo Formoso 2007-12-27 18:55:47 +01:00
parent a8636eaa60
commit 1e4851792b
2 changed files with 9 additions and 1 deletions

View File

@ -23,6 +23,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
#include <locale.h>
#include <langinfo.h>
static static
void ecma119_image_free(Ecma119Image *t) void ecma119_image_free(Ecma119Image *t)
@ -40,6 +42,7 @@ void ecma119_image_free(Ecma119Image *t)
free(writer); free(writer);
} }
free(t->input_charset); free(t->input_charset);
free(t->output_charset);
free(t->writers); free(t->writers);
free(t); free(t);
} }
@ -748,7 +751,11 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts,
target->now = time(NULL); target->now = time(NULL);
target->ms_block = 0; target->ms_block = 0;
target->input_charset = strdup("UTF-8"); //TODO
/* default to locale charset */
setlocale(LC_CTYPE, "");
target->input_charset = strdup(nl_langinfo(CODESET));
target->output_charset = strdup(target->input_charset); //TODO
/* /*
* 2. Based on those options, create needed writers: iso, joliet... * 2. Based on those options, create needed writers: iso, joliet...

View File

@ -61,6 +61,7 @@ struct ecma119_image {
ino_t ino; ino_t ino;
char *input_charset; char *input_charset;
char *output_charset;
uint32_t ms_block; /**< start block for a ms image */ uint32_t ms_block; /**< start block for a ms image */
time_t now; /**< Time at which writing began. */ time_t now; /**< Time at which writing began. */