+/* Converts the string TEXT, which should be encoded in FROM-encoding, to a
+ dynamically allocated string in TO-encoding. Any characters which cannot be
+ converted will be represented by '?'.
+
+ The returned string will be null-terminated and allocated on POOL with
+ pool_malloc().
+
+ This function's behaviour differs from that of g_convert_with_fallback
+ provided by GLib. The GLib function will fail (returns NULL) if any part of
+ the input string is not valid in the declared input encoding. This function
+ however perseveres even in the presence of badly encoded input. */
+struct substring
+recode_substring_pool (const char *to, const char *from,
+ struct substring text, struct pool *pool)
+{
+ struct substring out;
+
+ recode_substring_pool__ (to, from, text, '?', pool, &out);
+ return out;
+}
+
+/* Converts the string TEXT, which should be encoded in FROM-encoding, to a
+ dynamically allocated string in TO-encoding. On success, returns 0, and the
+ converted null-terminated string, allocated from POOL with pool_malloc(), is
+ stored in *OUT. On failure, returns a positive errno value.
+
+ The function fails with an error if any part of the input string is not
+ valid in the declared input encoding. */
+int
+recode_pedantically (const char *to, const char *from,
+ struct substring text, struct pool *pool,
+ struct substring *out)
+{
+ int error;
+
+ error = recode_substring_pool__ (to, from, text, 0, pool, out);
+ if (error)
+ *out = ss_empty ();
+ return error;
+}
+\f