[PATCH] linux: Add UTF-8 encoding support.

Martin Pitt martin.pitt at ubuntu.com
Tue Sep 3 03:34:49 PDT 2013

Shih-Yuan Lee (FourDollars) [2013-09-03 18:04 +0800]:
> > It is because when I run ‘/usr/lib/upower/upowerd -v` and `upower --dump`.

Is upower --dump actually wrong? The way how upowerd reads attribute
names should not depend on the locale that upowerd runs under; if it
does, we need to fix that properly.

upowerd -v's own debug output could be wrong, though.

> > The UTF-8 string can not be shown correctly.
> > Is there other general UTF-8 locale we can use?
> How about using `setlocale(LC_ALL, "C.UTF-8")` instead?

I'd prefer setlocale(LC_ALL, ""), so that it runs under the locale
that the environment actually defines. So if someone uses a non-UTF8
locale it'll still be correct, and we don't need to assume that any
particular naming exists.

Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

More information about the devkit-devel mailing list