correctly handle encoding issues when reading the x11 selection