non-ASCII chars in device names
Heya,
I got this report for gnome-bluetooth some time ago:
http://bugzilla.gnome.org/show_bug.cgi?id=380408
I fixed the problem altogether by replacing this code by D-Bus code calling hcid. The problem is that the name of the device only shows up the very first time the device is discovered, and it seems to me that the cache is busted:
In hcid/storage.c:
for (i = 0; i < 248 && name[i]; i++)
if ((unsigned char) name[i] < 32 || name[i] == 127)
str[i] = '.';
else
str[i] = name[i];Why? If the data is correct UTF-8, it could be saved as-is in the file, minus any tabs, unbreakable spaces, or line feeds.
Signature · 12 lines
Bastien Nocera <[email protected]> ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Bluez-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Bastien,
Quoted 9 lines
I got this report for gnome-bluetooth some time ago:
http://bugzilla.gnome.org/show_bug.cgi?id=380408I fixed the problem altogether by replacing this code by D-Bus code calling hcid. The problem is that the name of the device only shows up the very first time the device is discovered, and it seems to me that the cache is busted:
In
hcid/storage.c:
Quoted 8 lines
for (i = 0; i < 248 && name[i]; i++) if ((unsigned char) name[i] < 32 || name[i] == 127) str[i] = '.'; else str[i] = name[i];Why? If the data is correct UTF-8, it could be saved as-is in the file, minus any tabs, unbreakable spaces, or line feeds.
I don't see any problem with this code. It only replaces all ASCII control characters (including delete). So this must be an issue with still having the old name in the cache.
Regards
Marcel
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Quoted 17 lines · Marcel Holtmann
Hi Bastien,
Quoted 15 lines
I got this report for gnome-bluetooth some time ago:
http://bugzilla.gnome.org/show_bug.cgi?id=380408I fixed the problem altogether by replacing this code by D-Bus code calling hcid. The problem is that the name of the device only shows up the very first time the device is discovered, and it seems to me that the cache is busted:
In
hcid/storage.c:for (i = 0; i < 248 && name[i]; i++) if ((unsigned char) name[i] < 32 || name[i] == 127) str[i] = '.'; else str[i] = name[i];
Quoted 6 lines
Quoted 2 lines
Why? If the data is correct UTF-8, it could be saved as-is in the file, minus any tabs, unbreakable spaces, or line feeds.
I don't see any problem with this code. It only replaces all ASCII control characters (including delete). So this must be an issue with still having the old name in the cache.
It wasn't the old cache (as I delete it, to be sure) but an old bluez-utils (3.7) that had this problem. Works fine with 3.9.
Cheers
Signature · 12 lines
Bastien Nocera <[email protected]> ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Bluez-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bluez-devel
Hi Bastien,
Quoted 10 lines · Bastien Nocera
Quoted 10 lines
Quoted 9 lines
In
hcid/storage.c:for (i = 0; i < 248 && name[i]; i++) if ((unsigned char) name[i] < 32 || name[i] == 127) str[i] = '.'; else str[i] = name[i];Why? If the data is correct UTF-8, it could be saved as-is in the file, minus any tabs, unbreakable spaces, or line feeds.
Quoted 6 lines
Quoted 3 lines
I don't see any problem with this code. It only replaces all ASCII control characters (including delete). So this must be an issue with still having the old name in the cache.
It wasn't the old cache (as I delete it, to be sure) but an old bluez-utils (3.7) that had this problem. Works fine with 3.9.
Yep, in 3.7 the unsigned char typecast was missing which caused all greater than 7 bit characters to be replaced by '.'
Johan
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel