GNOME Bugzilla – Bug 580947
Validate UTF-8 strings in gjs_string_to_utf8()
Last modified: 2009-05-05 20:26:25 UTC
Make sure that when converting a Javascript string to UTF-8 it is valid in GLib terms and doesn't contain any embedded NULs.
Created attachment 133692 [details] [review] Validate UTF-8 strings in gjs_string_to_utf8()
It seems a bit odd that utf16_to_utf8 is happy to spit out invalid utf8 from invalid utf16, but I guess that's how it works. Patch looks fine to me.
It surprised me a bit too. (Presumably I knew that it didnt' validate at some point since I wrote it, but it's been a long time.) Note that *most* validation is already done - the only part that can be invalid is that the result can contain non-characters.
Pushed.