Commit 0d79498a authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder
Browse files

Fall back to using ISO-8859-1.

2006-03-01  Morten Welinder  <terra@gnome.org>

	* xbase.c (xbase_read_header): Fall back to using ISO-8859-1.

	* boot.c (xbase_field_as_value): Simplify assuming ->char_map is
	always available.  Handle failing conversion.
parent f08f4130
......@@ -2,6 +2,7 @@ Gnumeric 1.6.3
Morten:
* Fix printing issue when sheet is zoomed. [#332932]
* Fix dbf import issue. [#332878]
--------------------------------------------------------------------------
Gnumeric 1.6.2
......
2006-03-01 Morten Welinder <terra@gnome.org>
* xbase.c (xbase_read_header): Fall back to using ISO-8859-1.
* boot.c (xbase_field_as_value): Simplify assuming ->char_map is
always available. Handle failing conversion.
2005-11-14 Jody Goldberg <jody@gnome.org>
* Release 1.6.1
2006-01-30 Jody Goldberg <jody@gnome.org>
* Release 1.6.2
......
......@@ -81,12 +81,22 @@ xbase_field_as_value (gchar *content, XBfield *field, XBfile *file)
switch (field->type) {
case 'C': {
if (file->char_map != (GIConv)-1)
val = value_new_string_nocopy (
g_convert_with_iconv (g_strchomp (s), -1,
file->char_map, NULL, NULL, NULL));
char *sutf8 = g_convert_with_iconv (g_strchomp (s), -1,
file->char_map, NULL, NULL, NULL);
if (!sutf8) {
char *t;
for (t = s; *t; t++)
if ((guchar)*t >= 0x7f)
*t = '?';
sutf8 = s;
s = NULL;
g_warning ("Unrepresentable characters replaced by '?'");
}
if (sutf8)
val = value_new_string_nocopy (sutf8);
else
val = value_new_string_nocopy (g_strchomp (s));
val = value_new_string ("???");
g_free (s);
return val;
}
case 'N':
......
......@@ -183,8 +183,15 @@ xbase_read_header (XBfile *x, ErrorInfo **ret_error)
codepages[i].name, codepages[i].codepage););
break;
}
if (codepages[i].id != 0)
fprintf (stderr, "unknown 0x%hhx\n!\n", hdr[29]);
if (x->char_map == (GIConv)-1) {
#if XBASE_DEBUG > 0
fprintf (stderr, "unknown 0x%x\n!\n", hdr[29]);
#endif
g_warning ("File has unknown or missing code page information (%x)",
hdr[29]);
/* Got any better idea? */
x->char_map = g_iconv_open ("UTF-8", "ISO-8859-1");
}
}
static XBfield *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment