Comment 11 for bug 369861

Revision history for this message
Khaled Hosny (khaledhosny) wrote :

It turned out that UnicodeMap::mapUnicode does not handle surrogate pairs (characters outside Unicode's BMP) and that returning invalid UTF-8, which broke my files. Also, it does not handle invalid Unicode characters and just returns invalid UTF-8 that broke the files using windingabat font (the original bug report).

Attached a preliminary patch that uses g_utf16_to_utf8() to do the conversion, this ensures the returned UTF-8 is always valid (it returns NULL otherwise), this fixes surrogate pairs issue and makes sure the resulting SVG contains valid characters, with caveat that glyphs with no proper Unicode (unencoded glyphs) will be just omitted, this however can be fixed by converting glyphs to outlines in such case, but I think that would be another issue.