Skip to content
  • Thomas Haller's avatar
    device: sanitze UTF-8 values for D-Bus · 08709065
    Thomas Haller authored
      ip link add name $'d\xccf\\c' type dummy
    
    Use nm_utils_str_utf8safe_escape() to sanitize non UTF-8 sequences
    before exposing them on D-Bus. The operation can be reverted client
    side via nm_utils_str_utf8safe_unescape() or simply g_strcompress().
    
    Note that this preserves all valid UTF-8 sequences as-is, with exception
    of the backslash escape character and ASCII control characters. Thus, this
    is a change in behavior for strings that contain such characters.
    
    Note that nmcli is not changed to somehow unescape the string before
    printing. As the string is not valid UTF-8 (or contains ASCII characters
    that need escaping), they are not printable as-is, so unescaping before
    printing makes little sense.
    08709065