bluez/0001-Handle-ISO8859-1-device-names.patch
2010-12-01 15:35:13 +00:00

39 lines
1.1 KiB
Diff

From a4d043bc4c36b9dfff664d36ff724927d5817774 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Mon, 8 Nov 2010 16:43:42 +0000
Subject: [PATCH] Handle ISO8859-1 device names
http://thread.gmane.org/gmane.linux.bluez.kernel/1687
https://bugzilla.redhat.com/show_bug.cgi?id=450081
---
src/event.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/event.c b/src/event.c
index 47b50c4..1dbcad3 100644
--- a/src/event.c
+++ b/src/event.c
@@ -478,9 +478,16 @@ void btd_event_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status,
/* It's ok to cast end between const and non-const since
* we know it points to inside of name which is non-const */
- if (!g_utf8_validate(name, -1, (const char **) &end))
- *end = '\0';
-
+ if (!g_utf8_validate(name, -1, (const char **) &end)) {
+ char *utf8_name;
+
+ utf8_name = g_convert(name, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
+ if (utf8_name) {
+ memcpy(name, utf8_name, 248);
+ g_free(utf8_name);
+ } else
+ *end = '\0';
+ }
write_device_name(local, peer, name);
}
--
1.7.3.2