mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add gnc_utf8_strip_invalid_strdup() that returns a stripped copy instead of working in-place.
BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14679 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
3fc7807fda
commit
dfaec6654b
@ -1,5 +1,9 @@
|
||||
2006-08-15 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* src/core-utils/gnc-glib-utils.[hc]: Add
|
||||
gnc_utf8_strip_invalid_strdup() that returns a stripped copy
|
||||
instead of working in-place.
|
||||
|
||||
* src/import-export/hbci/dialog-hbcitrans.c (blz_changed_cb):
|
||||
Ensure the encoding of the ktoblzcheck library is used
|
||||
correctly. Their encoding is still always ISO-8859-1, but in
|
||||
|
@ -214,3 +214,11 @@ gnc_utf8_strip_invalid (gchar *str)
|
||||
memmove(end, end+1, len); /* shuffle the remainder one byte */
|
||||
} while (!gnc_utf8_validate(str, -1, (const gchar **)&end));
|
||||
}
|
||||
|
||||
gchar *
|
||||
gnc_utf8_strip_invalid_strdup(const gchar* str)
|
||||
{
|
||||
gchar *result = g_strdup (str);
|
||||
gnc_utf8_strip_invalid (result);
|
||||
return result;
|
||||
}
|
||||
|
@ -67,6 +67,20 @@ int safe_utf8_collate (const char *str1, const char *str2);
|
||||
* characters. */
|
||||
void gnc_utf8_strip_invalid (gchar *str);
|
||||
|
||||
/** Returns a newly allocated copy of the given string but with any
|
||||
* non-utf8 character stripped from it.
|
||||
*
|
||||
* Note that it also removes some subset of invalid XML characters,
|
||||
* too. See http://www.w3.org/TR/REC-xml/#NT-Char linked from bug
|
||||
* #346535
|
||||
*
|
||||
* @param str A pointer to the string to be copied and stripped of
|
||||
* non-utf8 characters.
|
||||
*
|
||||
* @return A newly allocated string that has to be g_free'd by the
|
||||
* caller. */
|
||||
gchar *gnc_utf8_strip_invalid_strdup (const gchar* str);
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user