[patch] filter invalid utf-8 characters from volume labels
Joe Shaw
joeshaw at novell.com
Thu Jul 29 08:05:03 PDT 2004
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.
I guess that's true; this just isn't a win-win in any case.
> 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.
My only objection to validating on string set is that validating UTF-8
is a very expensive operation. There's no silver bullet unfortunately;
the best we can probably do is validate in those fewer cases when we're
reading data from an external source, and either treat it as invalid
UTF-8 or try to convert it from some other character encoding.
Unfortunately, I think it's a manual process.
Joe
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list