diff --git a/xpra/client/base/gobject_client_base.py b/xpra/client/base/gobject_client_base.py index bc878ff260..df17e53b77 100644 --- a/xpra/client/base/gobject_client_base.py +++ b/xpra/client/base/gobject_client_base.py @@ -12,7 +12,7 @@ from gi.repository import GLib, GObject # @UnresolvedImport from xpra.util import ( - u, net_utf8, nonl, sorted_nicely, print_nested_dict, envint, flatten_dict, typedict, + u, nonl, sorted_nicely, print_nested_dict, envint, flatten_dict, typedict, disconnect_is_an_error, ellipsizer, first_time, csv, repr_ellipsized, ConnectionMessage, stderr_print, ) @@ -577,7 +577,7 @@ def _process_shell_reply(self, packet : PacketType) -> None: stream = sys.stderr else: raise ValueError(f"invalid file descriptor f{fd}") - s = net_utf8(message) + s = str(message) if s.endswith("\n"): s = s[:-1] stream.write("%s" % s) diff --git a/xpra/client/gtk3/gtk_client_window_base.py b/xpra/client/gtk3/gtk_client_window_base.py index 37b480c3db..568c82ac5c 100644 --- a/xpra/client/gtk3/gtk_client_window_base.py +++ b/xpra/client/gtk3/gtk_client_window_base.py @@ -18,7 +18,7 @@ from xpra.os_util import bytestostr, strtobytes, is_X11, WIN32, OSX, POSIX from xpra.util import ( - typedict, envint, envbool, csv, first_time, net_utf8, MoveResize, + typedict, envint, envbool, csv, first_time, MoveResize, WORKSPACE_UNSET, WORKSPACE_ALL, WORKSPACE_NAMES, MOVERESIZE_DIRECTION_STRING, SOURCE_INDICATION_STRING, ) from xpra.gtk_common.gobject_util import no_arg_signal, one_arg_signal @@ -1089,8 +1089,7 @@ def cancel_send_iconifiy_timer(self) -> None: def set_command(self, command) -> None: - v = net_utf8(command) - self.set_x11_property("WM_COMMAND", "latin1", v) + self.set_x11_property("WM_COMMAND", "latin1", command) def set_x11_property(self, prop_name:str, dtype=None, value=None) -> None: if not HAS_X11_BINDINGS: diff --git a/xpra/client/gtk3/open_requests.py b/xpra/client/gtk3/open_requests.py index fadf5e7073..c80c55d5d5 100755 --- a/xpra/client/gtk3/open_requests.py +++ b/xpra/client/gtk3/open_requests.py @@ -10,7 +10,7 @@ from time import monotonic import gi -from xpra.util import envint, net_utf8 +from xpra.util import envint from xpra.os_util import bytestostr, WIN32, OSX from xpra.gtk_common.gobject_compat import register_os_signals from xpra.child_reaper import getChildReaper @@ -103,14 +103,14 @@ def btn(self, label, callback, icon_name=None): return btn - def add_request(self, cb_answer, send_id, dtype, url, filesize, printit, openit, timeout): + def add_request(self, cb_answer, send_id:str, dtype:str, url:str, filesize:int, printit:bool, openit:bool, timeout:int): expires = monotonic()+timeout - self.requests.append((cb_answer, net_utf8(send_id), net_utf8(dtype), net_utf8(url), filesize, printit, openit, expires)) + self.requests.append((cb_answer, send_id, dtype, url, filesize, printit, openit, expires)) self.populate_table() if not self.populate_timer: self.schedule_timer() - def update_expires_label(self): + def update_expires_label(self) -> bool: expired = 0 for label, expiry in self.expire_labels.values(): seconds = max(0, expiry-monotonic()) diff --git a/xpra/client/gtk3/start_new_command.py b/xpra/client/gtk3/start_new_command.py index f6336a280d..d7277b5f82 100755 --- a/xpra/client/gtk3/start_new_command.py +++ b/xpra/client/gtk3/start_new_command.py @@ -15,7 +15,7 @@ add_close_accel, scaled_image, get_icon_pixbuf, ) from xpra.gtk_common.gobject_compat import register_os_signals -from xpra.util import typedict, net_utf8 +from xpra.util import typedict from xpra.log import Logger, enable_debug_for log = Logger("exec") @@ -28,21 +28,12 @@ def getStartNewCommand(run_callback, can_share=False, xdg_menu=None): _instance = StartNewCommand(run_callback, can_share, xdg_menu) return _instance -def udict(d): - #with rencode, we may get bytes instead of strings: - t = typedict() - for k, v in d.items(): - if isinstance(k, bytes): - k = net_utf8(k) - t[k] = v - return t - class StartNewCommand: def __init__(self, run_callback=None, can_share=False, xdg_menu=None): self.run_callback = run_callback - self.xdg_menu = udict(xdg_menu or {}) + self.xdg_menu = typedict(xdg_menu or {}) self.window = Gtk.Window() self.window.set_border_width(20) self.window.connect("delete-event", self.close) @@ -123,7 +114,7 @@ def accel_close(*_args): def category_changed(self, *args): category = self.category_combo.get_active_text() - entries = udict(udict(self.xdg_menu.dictget(category, {})).dictget("Entries", {})) + entries = typedict(typedict(self.xdg_menu.dictget(category, {})).dictget("Entries", {})) log("category_changed(%s) category=%s, entries=%s", args, category, entries) self.command_combo.get_model().clear() for name in entries.keys(): @@ -135,14 +126,14 @@ def command_changed(self, *args): if not self.entry: return category = self.category_combo.get_active_text() - entries = udict(udict(self.xdg_menu.dictget(category, {})).dictget("Entries", {})) + entries = typedict(typedict(self.xdg_menu.dictget(category, {})).dictget("Entries", {})) command_name = self.command_combo.get_active_text() log("command_changed(%s) category=%s, entries=%s, command_name=%s", args, category, entries, command_name) command = "" if entries and command_name: - command_props = udict(udict(entries).dictget(command_name, {})) + command_props = typedict(typedict(entries).dictget(command_name, {})) log("command properties=%s", command_props) - command = udict(command_props).strget("command", "") + command = typedict(command_props).strget("command", "") self.entry.set_text(command) def show(self): diff --git a/xpra/client/gui/client_window_base.py b/xpra/client/gui/client_window_base.py index 7fc75b0b63..92e7d6984c 100644 --- a/xpra/client/gui/client_window_base.py +++ b/xpra/client/gui/client_window_base.py @@ -14,7 +14,7 @@ from xpra.scaling_parser import scaleup_value, scaledown_value from xpra.os_util import bytestostr, OSX, WIN32, is_Wayland from xpra.common import GravityStr -from xpra.util import net_utf8, typedict, envbool, envint, std, WORKSPACE_UNSET, WORKSPACE_NAMES +from xpra.util import typedict, envbool, envint, std, WORKSPACE_UNSET, WORKSPACE_NAMES from xpra.log import Logger log = Logger("window") @@ -356,7 +356,7 @@ def getvar(var): value = metadata.get(var) or self._metadata.get(var) if value is None: return default_values.get(var, "" % var) - return net_utf8(value) + return str(value) def metadata_replace(match): atvar = match.group(0) #ie: '@title@' var = atvar[1:len(atvar)-1] #ie: 'title' @@ -390,7 +390,7 @@ def set_metadata(self, metadata:typedict): if "icon-title" in metadata: icon_title = metadata.strget("icon-title", "") - self.set_icon_name(net_utf8(icon_title)) + self.set_icon_name(icon_title) #the DE may have reset the icon now, #force it to use the one we really want: self.reset_icon() diff --git a/xpra/client/mixins/notifications.py b/xpra/client/mixins/notifications.py index b5a4ad2cbc..b5241b2fff 100644 --- a/xpra/client/mixins/notifications.py +++ b/xpra/client/mixins/notifications.py @@ -9,7 +9,7 @@ from xpra.platform.paths import get_icon_filename from xpra.platform.gui import get_native_notifier_classes from xpra.net.common import PacketType -from xpra.util import envbool, repr_ellipsized, make_instance, updict, typedict, net_utf8 +from xpra.util import envbool, repr_ellipsized, make_instance, updict, typedict from xpra.client.base.stub_client_mixin import StubClientMixin from xpra.log import Logger @@ -157,11 +157,11 @@ def _process_notify_show(self, packet : PacketType): self._ui_event() dbus_id = packet[1] nid = int(packet[2]) - app_name = net_utf8(packet[3]) + app_name = str(packet[3]) replaces_nid = int(packet[4]) app_icon = packet[5] - summary = net_utf8(packet[6]) - body = net_utf8(packet[7]) + summary = str(packet[6]) + body = str(packet[7]) expire_timeout = int(packet[8]) icon = None actions, hints = [], {} diff --git a/xpra/client/mixins/remote_logging.py b/xpra/client/mixins/remote_logging.py index f777382c77..9c8cea5d67 100644 --- a/xpra/client/mixins/remote_logging.py +++ b/xpra/client/mixins/remote_logging.py @@ -9,7 +9,7 @@ from time import monotonic from threading import Lock -from xpra.util import csv, typedict, repr_ellipsized, net_utf8 +from xpra.util import csv, typedict, repr_ellipsized from xpra.client.base.stub_client_mixin import StubClientMixin from xpra.log import Logger, set_global_logging_handler from xpra.net.common import PacketType @@ -93,9 +93,9 @@ def _process_logging(self, packet : PacketType) -> None: prefix += "@%02i.%03i " % ((dtime//1000)%60, dtime%1000) try: if isinstance(msg, (tuple, list)): - dmsg = " ".join(net_utf8(x) for x in msg) + dmsg = " ".join(str(x) for x in msg) else: - dmsg = net_utf8(msg) + dmsg = str(msg) for l in dmsg.splitlines(): self.do_log(level, prefix+l) except Exception as e: diff --git a/xpra/clipboard/clipboard_core.py b/xpra/clipboard/clipboard_core.py index 760e6d8f81..cb2b217f0a 100644 --- a/xpra/clipboard/clipboard_core.py +++ b/xpra/clipboard/clipboard_core.py @@ -680,7 +680,7 @@ def _may_compress(self, dtype:str, dformat:int, wire_data): if isinstance(wire_data, (str, bytes)) and l>=MIN_CLIPBOARD_COMPRESS_SIZE: if isinstance(wire_data, str): #compression requires bytes: - #but this would require the receiving end to use net_utf8() + #but this would require the receiving end to know it needs to decode the bytes wire_data = wire_data.encode("utf8") log("encoded %i characters to %i utf8 bytes", l, len(wire_data)) return Compressible(f"clipboard: {dtype} / {dformat}", wire_data) diff --git a/xpra/gtk_common/gtk_clipboard.py b/xpra/gtk_common/gtk_clipboard.py index 24fa53cb10..36f6edfcc8 100644 --- a/xpra/gtk_common/gtk_clipboard.py +++ b/xpra/gtk_common/gtk_clipboard.py @@ -14,7 +14,7 @@ ClipboardProxyCore, TEXT_TARGETS, ) from xpra.clipboard.clipboard_timeout_helper import ClipboardTimeoutHelper -from xpra.util import ellipsizer, envint, net_utf8 +from xpra.util import ellipsizer, envint from xpra.log import Logger @@ -78,7 +78,7 @@ def got_token(self, targets, target_data=None, claim=True, synchronous_client=Fa dtype, dformat, data = target_data.get(text_target) if dformat!=8: continue - text = net_utf8(data) + text = str(data) log("setting text data %s / %s of size %i: %s", dtype, dformat, len(text), ellipsizer(text)) self._owner_change_embargo = monotonic() diff --git a/xpra/net/file_transfer.py b/xpra/net/file_transfer.py index 679168ae57..49622e47bd 100644 --- a/xpra/net/file_transfer.py +++ b/xpra/net/file_transfer.py @@ -16,7 +16,7 @@ from xpra.child_reaper import getChildReaper from xpra.os_util import bytestostr, strtobytes, umask_context, POSIX, WIN32 -from xpra.util import typedict, csv, envint, envbool, engs, net_utf8, u +from xpra.util import typedict, csv, envint, envbool, engs, u from xpra.scripts.config import parse_bool, parse_with_unit from xpra.net.common import PacketType from xpra.simple_stats import std_unit @@ -369,7 +369,6 @@ def clean_receive_state(): def _process_send_file_chunk(self, packet : PacketType) -> None: chunk_id, chunk, file_data, has_more = packet[1:5] - chunk_id = net_utf8(chunk_id) #if len(file_data)<1024: # from xpra.os_util import hexstr # filelog.warn("file_data=%s", hexstr(file_data)) @@ -484,10 +483,7 @@ def _process_send_file(self, packet : PacketType) -> None: basefilename, mimetype, printit, openit, filesize, file_data, options = packet[1:8] send_id = "" if len(packet)>=9: - send_id = net_utf8(packet[8]) - #basefilename should be utf8: - basefilename = net_utf8(basefilename) - mimetype = net_utf8(mimetype) + send_id = str(packet[8]) if filesize<=0: filelog.error("Error: invalid file size: %s", filesize) filelog.error(" file transfer aborted for %r", basefilename) @@ -728,8 +724,8 @@ def send_request_file(self, filename:str, openit:bool=True): def _process_open_url(self, packet : PacketType): - send_id = net_utf8(packet[2]) - url = net_utf8(packet[1]) + send_id = str(packet[2]) + url = str(packet[1]) if not self.open_url: filelog.warn("Warning: received a request to open URL '%s'", url) filelog.warn(" but opening of URLs is disabled") @@ -820,9 +816,6 @@ def _process_send_data_request(self, packet : PacketType) -> None: if len(packet)>=9: options = packet[8] #filenames and url are always sent encoded as utf8: - url = net_utf8(url) - dtype = net_utf8(dtype) - send_id = net_utf8(send_id) self.do_process_send_data_request(dtype, send_id, url, _, filesize, printit, openit, typedict(options)) @@ -880,7 +873,6 @@ def ask_data_request(self, cb_answer:Callable, send_id:str, dtype:str, url:str, def _process_send_data_response(self, packet : PacketType) -> None: send_id, accept = packet[1:3] - send_id = net_utf8(send_id) filelog("process send-data-response: send_id=%s, accept=%s", send_id, accept) timer = self.pending_send_data_timers.pop(send_id, None) if timer: @@ -889,8 +881,8 @@ def _process_send_data_response(self, packet : PacketType) -> None: if v is None: filelog.warn("Warning: cannot find send-file entry") return - dtype = net_utf8(v[0]) - url = net_utf8(v[1]) + dtype = str(v[0]) + url = str(v[1]) if accept==DENY: filelog.info("the request to send %s '%s' has been denied", dtype, url) return @@ -994,10 +986,10 @@ def _process_ack_file_chunk(self, packet : PacketType) -> None: #send some more file data filelog("ack-file-chunk: %s", packet[1:]) chunk_id, state, error_message, chunk = packet[1:5] - chunk_id = net_utf8(chunk_id) + chunk_id = str(chunk_id) if not state: filelog.info("the remote end is cancelling the file transfer:") - filelog.info(" %s", net_utf8(error_message)) + filelog.info(" %s", error_message) self.cancel_sending(chunk_id) return chunk_state = self.send_chunks_in_progress.get(chunk_id) diff --git a/xpra/platform/darwin/osx_clipboard.py b/xpra/platform/darwin/osx_clipboard.py index 4e5b442e65..42a931f989 100644 --- a/xpra/platform/darwin/osx_clipboard.py +++ b/xpra/platform/darwin/osx_clipboard.py @@ -18,7 +18,7 @@ _filter_targets, ClipboardProxyCore, TEXT_TARGETS, ) from xpra.platform.ui_thread_watcher import get_UI_watcher -from xpra.util import csv, net_utf8, ellipsizer +from xpra.util import csv, ellipsizer from xpra.os_util import bytestostr from xpra.log import Logger @@ -188,7 +188,7 @@ def got_contents(self, target, dtype=None, dformat=None, data=None): return if dformat==8 and dtype in TEXT_TARGETS: log("we got a byte string: %s", ellipsizer(data)) - self.set_clipboard_text(net_utf8(data)) + self.set_clipboard_text(bytestostr(data)) if dformat==8 and dtype in IMAGE_FORMATS: log("we got a %s image", dtype) self.set_image_data(dtype, data) diff --git a/xpra/platform/posix/remotedesktop.py b/xpra/platform/posix/remotedesktop.py index f1a51cd346..7b233b0546 100755 --- a/xpra/platform/posix/remotedesktop.py +++ b/xpra/platform/posix/remotedesktop.py @@ -10,7 +10,6 @@ from gi.repository import Gdk from dbus.types import UInt32, Int32 -from xpra.util import net_utf8 from xpra.dbus.helper import native_to_dbus from xpra.net.common import PacketType from xpra.platform.posix.fd_portal import REMOTEDESKTOP_IFACE @@ -78,10 +77,10 @@ def do_process_button_action(self, proto, device_id:int, wid:int, button:int, pr def _process_key_action(self, proto, packet : PacketType) -> None: if self.readonly or not self.input_devices or not self.keymap: return - keyname = net_utf8(packet[2]) + keyname = str(packet[2]) pressed = bool(packet[3]) keyval = int(packet[5]) - keystr = net_utf8(packet[6]) + keystr = str(packet[6]) ss = self.get_server_source(proto) if ss is None: return diff --git a/xpra/platform/win32/clipboard.py b/xpra/platform/win32/clipboard.py index e414785bbf..ae8c380437 100644 --- a/xpra/platform/win32/clipboard.py +++ b/xpra/platform/win32/clipboard.py @@ -35,7 +35,7 @@ ClipboardProxyCore, log, _filter_targets, TEXT_TARGETS, MAX_CLIPBOARD_PACKET_SIZE, ) -from xpra.util import net_utf8, csv, ellipsizer, envint, envbool, roundup +from xpra.util import csv, ellipsizer, envint, envbool, roundup from xpra.os_util import bytestostr from xpra.platform.win32.constants import PROCESS_QUERY_INFORMATION @@ -570,7 +570,7 @@ def got_contents(self, target, dtype=None, dformat=None, data=None): self.send_clipboard_request_handler(self, self._selection, image_formats[0]) elif dformat==8 and dtype in TEXT_TARGETS: log("we got a byte string: %s", ellipsizer(data)) - self.set_clipboard_text(net_utf8(data)) + self.set_clipboard_text(bytestostr(data)) elif dformat==8 and dtype.startswith("image/"): img_format = dtype.split("/")[-1] #ie: 'png' self.set_clipboard_image(img_format, data) diff --git a/xpra/server/mixins/controlcommands.py b/xpra/server/mixins/controlcommands.py index 44c4388317..08d08f3a7a 100644 --- a/xpra/server/mixins/controlcommands.py +++ b/xpra/server/mixins/controlcommands.py @@ -9,7 +9,7 @@ from time import monotonic from typing import List -from xpra.util import parse_scaling_value, csv, from0to100, net_utf8, typedict, ConnectionMessage +from xpra.util import parse_scaling_value, csv, from0to100, typedict, ConnectionMessage from xpra.os_util import load_binary_file from xpra.net.common import PacketType from xpra.simple_stats import std_unit @@ -319,7 +319,6 @@ def control_command_send_file(self, filename:str, openit:str="open", client_uuid #we always get the values as strings from the command interface, #but those may actually be utf8 encoded binary strings, #so we may have to do an ugly roundtrip: - filename = net_utf8(filename) openit = str(openit).lower() in ("open", "true", "1") return self.do_control_file_command("send file", client_uuids, filename, "file_transfer", (False, openit)) diff --git a/xpra/server/mixins/input.py b/xpra/server/mixins/input.py index eca162520c..4b8310dd1f 100644 --- a/xpra/server/mixins/input.py +++ b/xpra/server/mixins/input.py @@ -10,7 +10,7 @@ from typing import List, Dict, Any, Optional from xpra.os_util import bytestostr -from xpra.util import typedict, net_utf8, envbool +from xpra.util import typedict, envbool from xpra.net.common import PacketType from xpra.server.mixins.stub_server_mixin import StubServerMixin from xpra.log import Logger @@ -171,9 +171,9 @@ def _process_key_action(self, proto, packet : PacketType) -> None: ss = self.get_server_source(proto) if ss is None: return - keyname = net_utf8(keyname) - keystr = net_utf8(keystr) - modifiers = list(net_utf8(x) for x in modifiers) + keyname = str(keyname) + keystr = str(keystr) + modifiers = list(str(x) for x in modifiers) self.set_ui_driver(ss) keycode, group = self.get_keycode(ss, client_keycode, keyname, pressed, modifiers, keyval, keystr, group) keylog("process_key_action(%s) server keycode=%s, group=%i", packet, keycode, group) diff --git a/xpra/server/mixins/logging.py b/xpra/server/mixins/logging.py index 4547e2e804..dab1225558 100644 --- a/xpra/server/mixins/logging.py +++ b/xpra/server/mixins/logging.py @@ -13,7 +13,7 @@ from typing import Dict, Any, Optional, Callable from xpra.os_util import bytestostr -from xpra.util import repr_ellipsized, net_utf8 +from xpra.util import repr_ellipsized from xpra.net.common import PacketType from xpra.scripts.config import FALSE_OPTIONS, TRUE_OPTIONS from xpra.server.mixins.stub_server_mixin import StubServerMixin @@ -192,9 +192,9 @@ def _process_logging(self, proto, packet : PacketType) -> None: prefix += "@%02i.%03i " % ((dtime//1000)%60, dtime%1000) try: if isinstance(msg, (tuple, list)): - dmsg = " ".join(net_utf8(x) for x in msg) + dmsg = " ".join(str(x) for x in msg) else: - dmsg = net_utf8(msg) + dmsg = str(msg) for l in dmsg.splitlines(): self.do_log(level, prefix+l) except Exception as e: diff --git a/xpra/server/server_core.py b/xpra/server/server_core.py index be84422f5f..103e35b38b 100644 --- a/xpra/server/server_core.py +++ b/xpra/server/server_core.py @@ -68,7 +68,7 @@ from xpra.make_thread import start_thread from xpra.common import LOG_HELLO, FULL_INFO from xpra.util import ( - first_time, noerr, net_utf8, + first_time, noerr, csv, merge_dicts, typedict, notypedict, flatten_dict, ellipsizer, repr_ellipsized, dump_all_frames, envint, envbool, envfloat, @@ -2129,7 +2129,7 @@ def send_fake_challenge() -> None: self.auth_verified(proto, c, auth_caps) def auth_verified(self, proto:SocketProtocol, caps:typedict, auth_caps:Dict) -> None: - command_req = tuple(net_utf8(x) for x in caps.tupleget("command_request")) + command_req = tuple(str(x) for x in caps.tupleget("command_request")) if command_req: #call from UI thread: authlog(f"auth_verified(..) command request={command_req}") diff --git a/xpra/server/source/clientinfo.py b/xpra/server/source/clientinfo.py index c4fc9aa7c7..48db26d0ab 100644 --- a/xpra/server/source/clientinfo.py +++ b/xpra/server/source/clientinfo.py @@ -6,7 +6,7 @@ from typing import Dict, List, Any, Tuple -from xpra.util import std, typedict, net_utf8 +from xpra.util import std, typedict from xpra.common import FULL_INFO from xpra.version_util import vparts from xpra.server.source.stub_source_mixin import StubSourceMixin @@ -76,7 +76,7 @@ def parse_client_caps(self, c : typedict) -> None: self.client_revision = c.strget("build.revision") self.client_bits = c.intget("python.bits") self.client_proxy = c.boolget("proxy") - self.client_wm_name = c.conv_get("wm_name", "", net_utf8) + self.client_wm_name = c.strget("wm_name", "") self.client_session_type = c.strget("session-type") self.client_session_type_full = c.strget("session-type.full", "") self.client_setting_change = c.boolget("setting-change") diff --git a/xpra/server/source/display.py b/xpra/server/source/display.py index 82aa993ff3..f2efb39782 100644 --- a/xpra/server/source/display.py +++ b/xpra/server/source/display.py @@ -7,7 +7,7 @@ from typing import List, Tuple, Any, Optional, Dict, Iterable, Callable from xpra.os_util import bytestostr -from xpra.util import get_screen_info, first_time, typedict, net_utf8 +from xpra.util import get_screen_info, first_time, typedict from xpra.common import MIN_DPI, MAX_DPI from xpra.server.source.stub_source_mixin import StubSourceMixin from xpra.log import Logger @@ -71,7 +71,7 @@ def parse_client_caps(self, c : typedict) -> None: self.screen_resize_bigger = c.boolget("screen-resize-bigger", True) self.set_screen_sizes(c.tupleget("screen_sizes")) self.set_monitors(c.dictget("monitors")) - desktop_names = tuple(net_utf8(x) for x in c.tupleget("desktop.names")) + desktop_names = tuple(str(x) for x in c.tupleget("desktop.names")) self.set_desktops(c.intget("desktops", 1), desktop_names) self.show_desktop_allowed = c.boolget("show-desktop") self.icc = c.dictget("icc", {}) @@ -159,7 +159,7 @@ def dpi(size_pixels, size_mm) -> int: def set_desktops(self, desktops:int, desktop_names) -> None: self.desktops = desktops or 1 - self.desktop_names = tuple(net_utf8(d) for d in (desktop_names or ())) + self.desktop_names = tuple(str(d) for d in (desktop_names or ())) def updated_desktop_size(self, root_w:int, root_h:int, max_w:int, max_h:int) -> bool: log("updated_desktop_size%s desktop_size=%s", (root_w, root_h, max_w, max_h), self.desktop_size) diff --git a/xpra/server/source/fileprint.py b/xpra/server/source/fileprint.py index d3a258dc91..17bdef0775 100644 --- a/xpra/server/source/fileprint.py +++ b/xpra/server/source/fileprint.py @@ -7,7 +7,7 @@ import os from typing import Dict, Any, Set -from xpra.util import envbool, typedict, net_utf8 +from xpra.util import envbool, typedict from xpra.os_util import get_machine_id from xpra.net.file_transfer import FileTransferHandler from xpra.server.source.stub_source_mixin import StubSourceMixin @@ -114,8 +114,7 @@ def makeabs(filename): #prefer sockets in public paths: attributes["socket-path"] = self.choose_socket_path() log("printer attributes: %s", attributes) - for name,props in printers.items(): - printer = net_utf8(name) + for printer,props in printers.items(): if printer not in self.printers: self.setup_printer(printer, props, attributes) @@ -161,8 +160,7 @@ def remove_printers(self) -> None: for k in tuple(self.printers_added): self.remove_printer(k) - def remove_printer(self, name) -> None: - printer = net_utf8(name) + def remove_printer(self, printer:str) -> None: try: self.printers_added.remove(printer) except KeyError: diff --git a/xpra/util.py b/xpra/util.py index 9109d59e90..44b033df89 100644 --- a/xpra/util.py +++ b/xpra/util.py @@ -190,25 +190,6 @@ def nicestr(obj): return str(obj) -def net_utf8(value) -> str: - """ - Given a value received by the network layer, - convert it to a string. - Gymnastics are involved if: - - we get a memoryview from lz4 - - the rencode packet encoder is used - as it ends up giving us a string which is actually utf8 bytes. - """ - #with 'rencodeplus' or 'bencode', we just get the unicode string directly: - if isinstance(value, str): - return value - if isinstance(value, memoryview): - value = value.tobytes() - #with rencode v1, we have to decode the value: - #(after converting it to 'bytes' if necessary) - return u(strtobytes(value)) - - def u(v) -> str: if isinstance(v, str): return v diff --git a/xpra/x11/server.py b/xpra/x11/server.py index c837a29cca..69427ac811 100644 --- a/xpra/x11/server.py +++ b/xpra/x11/server.py @@ -15,7 +15,7 @@ from gi.repository import GObject, Gdk, GdkX11 # @UnresolvedImport from xpra.version_util import XPRA_VERSION -from xpra.util import net_utf8, updict, rindex, envbool, envint, typedict, WORKSPACE_NAMES +from xpra.util import updict, rindex, envbool, envint, typedict, WORKSPACE_NAMES from xpra.os_util import memoryview_to_bytes, strtobytes, bytestostr from xpra.common import CLOBBER_UPGRADE, MAX_WINDOW_SIZE from xpra.net.common import PacketType @@ -359,7 +359,7 @@ def calculate_desktops(self) -> None: name = "Main" if i==0 else f"Desktop {i+1}" for ss in sources: if ss.desktops and i