39 lines
1.1 KiB
Diff
39 lines
1.1 KiB
Diff
From 1dea0eac302036bd165f9e3e386c40da25512005 Mon Sep 17 00:00:00 2001
|
|
From: Bastien Nocera <hadess@hadess.net>
|
|
Date: Mon, 8 Nov 2010 16:43:42 +0000
|
|
Subject: [PATCH 3/3] 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 5d0bf6d..dc58dbd 100644
|
|
--- a/src/event.c
|
|
+++ b/src/event.c
|
|
@@ -652,9 +652,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
|
|
|