binding: bluetooth-pbap: parse fn correctly for UTF-8 charset 56/21456/1 7.99.1 halibut/7.99.1 halibut_7.99.1
authorMatt Ranostay <matt.ranostay@konsulko.com>
Wed, 29 May 2019 18:22:22 +0000 (11:22 -0700)
committerMatt Ranostay <matt.ranostay@konsulko.com>
Wed, 29 May 2019 18:27:25 +0000 (11:27 -0700)
Don't include CHARSET=UTF-8 or the like in the JSON output.

Bug-AGL: SPEC-2392
Change-Id: I85322e710b737bdfa58fe80ff5f0bbc0e298250b
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
binding/bluetooth-vcard-parser.c

index 927443a..0b63209 100644 (file)
@@ -51,12 +51,12 @@ static const gchar *VC_PREFIXES[VC_FIELD_COUNT] = {
 
 static void add_fn(json_object *resp, gchar *msg)
 {
-       gchar *name = msg + vc_len(VC_FORMATTED_NAME) + 1;
+       gchar *name = strstr(msg, ":");
 
-       if (!name)
-               name = "UNKNOWN";
+       if (!name || !strlen(name + 1))
+               return;
 
-       json_object_object_add(resp, "fn", json_object_new_string(name));
+       json_object_object_add(resp, "fn", json_object_new_string(++name));
 }
 
 static void add_phone(json_object *array, gchar *msg)