[patch] filter invalid utf-8 characters from volume labels

Kay Sievers kay.sievers at vrfy.org
Thu Aug 5 12:46:12 PDT 2004


On Fri, 2004-07-30 at 12:50 -0400, Joe Shaw wrote:
> On Wed, 2004-07-28 at 23:26 +0200, Sjoerd Simons wrote:
> > This is one of those cases where i don't really care how it get's fixed as long
> > as it gets fixed :). Although i don't know if guessing that it's -15 when it's
> > not (or invalid) utf-8 is better then assuming there is garbage in an utf-8
> > string.
> >
> > The problem seems very general to hal atm though. One debian user apperently
> > has a MS usb mouse which has a 0xAE char (latin1 copyright sign) in it's
> > description[0]. 
> > 
> > Any ideas how to solve it more generally ? It's possible some code into 
> > hal_device_set_property_string to ensure that the string value is always valid 
> > utf-8. But that doesn't feel right, on the other hand ``fixing'' every place
> > where hal sets a string property with information from the outside is a lot of
> > work and probably error-prone.
> 
> Okay, I've pulled a patented Joe Shaw flip-flop, and have committed a
> patch which validates string properties as UTF-8 and replaces invalid
> sequences with question marks like in your patch.  I could run for
> public office with a record like this.

Do I need a licence now? :)
Today I've found my first user of this feature. I just got a DVD with a
'ä' character, stupid encoded as ISO8859-1 (in 16Bit values):

  http://vrfy.org/projects/hal/invalid-unicode.png


Good work,
Kay

_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list