#include <data/sys-file-writer.h>
#include <data/sys-file-reader.h>
#include <data/value.h>
+#include <data/vardict.h>
#include <data/value-labels.h>
#include <data/format.h>
#include <data/data-in.h>
+#include <data/data-out.h>
#include <string.h>
typedef struct fmt_spec input_format ;
const char *ver
CODE:
assert (0 == strcmp (ver, bare_version));
+ i18n_init ();
msg_init (NULL, message_handler);
settings_init (0, 0);
fh_init ();
CODE:
SV *ret;
const struct fmt_spec *fmt = var_get_print_format (var);
+ const struct dictionary *dict = var_get_vardict (var)->dict;
union value uv;
char *s;
make_value_from_scalar (&uv, val, var);
- s = data_out (&uv, fmt);
+ fprintf (stderr, "Encoding is %s\n", dict_get_encoding (dict));
+ s = data_out (&uv, dict_get_encoding (dict), fmt);
value_destroy (&uv, var_get_width (var));
ret = newSVpv (s, fmt->w);
free (s);
}
-/* Return a string based on TEXT converted according to HOW.
+/* Return a string based on TEXT which must be encoded using FROM.
+ The returned string will be encoded in TO.
If length is not -1, then it must be the number of bytes in TEXT.
The returned string must be freed when no longer required.
*/
if ( length == -1 )
length = strlen(text);
-
if (to == NULL)
to = default_encoding;