39 lines
1.1 KiB
Diff
39 lines
1.1 KiB
Diff
From 29efb2e97955c2e236410930fa8b913bf243d72b 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 e943c63..530004d 100644
|
|
--- a/src/event.c
|
|
+++ b/src/event.c
|
|
@@ -488,9 +488,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
|
|
|