Skip to content

Commit 4e2adc6

Browse files
committed
Merge pull request godotengine#112629 from Rindbee/fix-Chinese-characters-were-not-displayed-correctly-in-DBusMessage
Fix Chinese characters in DBusMessage were not displayed correctly
2 parents 699b662 + 5cb5eb5 commit 4e2adc6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

platform/linuxbsd/freedesktop_portal_desktop.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ bool FreeDesktopPortalDesktop::read_setting(const char *p_namespace, const char
121121
DBusConnection *bus = dbus_bus_get(DBUS_BUS_SESSION, &error);
122122
if (dbus_error_is_set(&error)) {
123123
if (OS::get_singleton()->is_stdout_verbose()) {
124-
ERR_PRINT(vformat("Error opening D-Bus connection: %s", error.message));
124+
ERR_PRINT(vformat("Error opening D-Bus connection: %s", String::utf8(error.message)));
125125
}
126126
dbus_error_free(&error);
127127
unsupported = true;
@@ -141,7 +141,7 @@ bool FreeDesktopPortalDesktop::read_setting(const char *p_namespace, const char
141141
dbus_message_unref(message);
142142
if (dbus_error_is_set(&error)) {
143143
if (OS::get_singleton()->is_stdout_verbose()) {
144-
ERR_PRINT(vformat("Error on D-Bus communication: %s", error.message));
144+
ERR_PRINT(vformat("Failed to read %s in %s, due to error on D-Bus communication: %s", p_key, p_namespace, String::utf8(error.message)));
145145
}
146146
dbus_error_free(&error);
147147
dbus_connection_unref(bus);
@@ -532,7 +532,7 @@ bool FreeDesktopPortalDesktop::color_picker(const String &p_xid, const Callable
532532
cd.filter = vformat("type='signal',sender='org.freedesktop.portal.Desktop',path='%s',interface='org.freedesktop.portal.Request',member='Response',destination='%s'", path, dbus_unique_name);
533533
dbus_bus_add_match(monitor_connection, cd.filter.utf8().get_data(), &err);
534534
if (dbus_error_is_set(&err)) {
535-
ERR_PRINT(vformat("Failed to add DBus match: %s", err.message));
535+
ERR_PRINT(vformat("Failed to add DBus match: %s", String::utf8(err.message)));
536536
dbus_error_free(&err);
537537
return false;
538538
}
@@ -553,7 +553,7 @@ bool FreeDesktopPortalDesktop::color_picker(const String &p_xid, const Callable
553553
dbus_message_unref(message);
554554

555555
if (!reply || dbus_error_is_set(&err)) {
556-
ERR_PRINT(vformat("Failed to send DBus message: %s", err.message));
556+
ERR_PRINT(vformat("Failed to call remote method PickColor, due to DBus error: %s", String::utf8(err.message)));
557557
dbus_error_free(&err);
558558
dbus_bus_remove_match(monitor_connection, cd.filter.utf8().get_data(), &err);
559559
return false;
@@ -569,14 +569,14 @@ bool FreeDesktopPortalDesktop::color_picker(const String &p_xid, const Callable
569569
if (String::utf8(new_path) != path) {
570570
dbus_bus_remove_match(monitor_connection, cd.filter.utf8().get_data(), &err);
571571
if (dbus_error_is_set(&err)) {
572-
ERR_PRINT(vformat("Failed to remove DBus match: %s", err.message));
572+
ERR_PRINT(vformat("Failed to remove DBus match: %s", String::utf8(err.message)));
573573
dbus_error_free(&err);
574574
return false;
575575
}
576576
cd.filter = String::utf8(new_path);
577577
dbus_bus_add_match(monitor_connection, cd.filter.utf8().get_data(), &err);
578578
if (dbus_error_is_set(&err)) {
579-
ERR_PRINT(vformat("Failed to add DBus match: %s", err.message));
579+
ERR_PRINT(vformat("Failed to add DBus match: %s", String::utf8(err.message)));
580580
dbus_error_free(&err);
581581
return false;
582582
}
@@ -723,7 +723,7 @@ Error FreeDesktopPortalDesktop::file_dialog_show(DisplayServer::WindowID p_windo
723723
fd.filter = vformat("type='signal',sender='org.freedesktop.portal.Desktop',path='%s',interface='org.freedesktop.portal.Request',member='Response',destination='%s'", path, dbus_unique_name);
724724
dbus_bus_add_match(monitor_connection, fd.filter.utf8().get_data(), &err);
725725
if (dbus_error_is_set(&err)) {
726-
ERR_PRINT(vformat("Failed to add DBus match: %s", err.message));
726+
ERR_PRINT(vformat("Failed to add DBus match: %s", String::utf8(err.message)));
727727
dbus_error_free(&err);
728728
return FAILED;
729729
}
@@ -765,7 +765,7 @@ Error FreeDesktopPortalDesktop::file_dialog_show(DisplayServer::WindowID p_windo
765765
dbus_message_unref(message);
766766

767767
if (!reply || dbus_error_is_set(&err)) {
768-
ERR_PRINT(vformat("Failed to send DBus message: %s", err.message));
768+
ERR_PRINT(vformat("Failed to call remote method %s, due to DBus error: %s", method, String::utf8(err.message)));
769769
dbus_error_free(&err);
770770
dbus_bus_remove_match(monitor_connection, fd.filter.utf8().get_data(), &err);
771771
return FAILED;
@@ -781,14 +781,14 @@ Error FreeDesktopPortalDesktop::file_dialog_show(DisplayServer::WindowID p_windo
781781
if (String::utf8(new_path) != path) {
782782
dbus_bus_remove_match(monitor_connection, fd.filter.utf8().get_data(), &err);
783783
if (dbus_error_is_set(&err)) {
784-
ERR_PRINT(vformat("Failed to remove DBus match: %s", err.message));
784+
ERR_PRINT(vformat("Failed to remove DBus match: %s", String::utf8(err.message)));
785785
dbus_error_free(&err);
786786
return FAILED;
787787
}
788788
fd.filter = String::utf8(new_path);
789789
dbus_bus_add_match(monitor_connection, fd.filter.utf8().get_data(), &err);
790790
if (dbus_error_is_set(&err)) {
791-
ERR_PRINT(vformat("Failed to add DBus match: %s", err.message));
791+
ERR_PRINT(vformat("Failed to add DBus match: %s", String::utf8(err.message)));
792792
dbus_error_free(&err);
793793
return FAILED;
794794
}

0 commit comments

Comments
 (0)