On 2010-02-28, Werner LEMBERG wrote:
I neglected to mention that in recent 2.13 versions, the warning
messages for invalid character encoding look like this:
(process:1375): Pango-WARNING **: Invalid UTF-8 string passed
to pango_layout_set_text()
These warnings are generated by Pango.
Is this an improvement?
Yes, thanks. I assume that it is not possible to add the offending
text string to the warning message since a Pango warning is not
visible to lilypond... Perhaps it makes sense to add a UTF-8 checker
to lilypond just for that.
It would be very simple to check for invalid UTF-8, since we can use
GLib's g_utf_validate() function. In fact, Pango uses this same
function in pango_layout_set_text().
Unfortunately, it would be much more complicated (I think) to output
the offending string, since we would have to convert an arbitrarily
encoded string to UTF-8, and then display it along with the
warning/error.
And this assumes we are dealing with a UTF-8 locale.
What if we output a message like this instead:
warning: invalid UTF-8 string found at row 3, column 10
I think this would be easier to implement.