Advertisement
Guest User

Untitled

a guest
Apr 9th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. modified libgnucash/backend/xml/gnc-xml-helper.cpp
  2. @@ -31,9 +31,10 @@ checked_char_cast (gchar* val)
  3. const int length = -1; /* Assumes val is null-terminated */
  4. gchar* end;
  5. if (val == NULL) return NULL;
  6. - /* Replace any invalid UTF-8 characters with a sequence of '?' */
  7. - while (!g_utf8_validate (val, length, (const gchar**) (&end)))
  8. - *end = '?';
  9. + /* Replace any invalid UTF-8 characters with a sequence of 'U+FFFD' */
  10. +
  11. + g_utf8_make_valid (val, -1);
  12. +
  13. /* Replace any invalid (for XML) control characters (everything < 0x20
  14. * except \n, \t, and \r) with '?'. Technically we should replace
  15. * these with a numeric entity, but that will blow up the libxml
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement