I believe we should fix this in software-properties.  The most flexible
way to do this is to use something like

if sys.getfilesystemencoding() == "ascii" and not "LANG" in os.environ:
    os.putenv("LANG", "C.UTF-8")
    with open("/etc/default/locale") as fobj:
        for line in fobj:
            line = line.split("#")[0].strip()
            if line:
                key, value = line.split("=", 1)
                os.putenv(key, value)

        os.execv(sys.argv[0], sys.argv)

before running other code in the dbus service. This will take care to
setup the system's default locale settings and then re-exec() itself  so
that Python picks this up (it will not change filesystem encoding
otherwise). In case no locale is set in /etc/default/locale, it falls
back to LANG=C.UTF-8.

This can be changed to use systemd's localed later on (I do not know if
it is currently installed), using:

        bus = dbus.SystemBus()
        localed = bus.get_object("org.freedesktop.locale1", 
"/org/freedesktop/locale1")
        loc = dbus.Interface(localed, 'org.freedesktop.locale1')
        props = dbus.Interface(localed, 'org.freedesktop.DBus.Properties')

        for locale in props.Get('org.freedesktop.locale1', 'Locale'):
                name, val = locale.split("=", 1)
                os.putenv(name, val)

to get the values instead of reading /etc/default/locale.

** Package changed: python-apt (Ubuntu) => software-properties (Ubuntu)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1069019

Title:
  [software-properties-gtk] can not delete, enable or modify any
  software source with non-ASCII characters in the comment

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/1069019/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to