From 78d9cee2e595836ed36983039fbced73d957334e Mon Sep 17 00:00:00 2001 From: liuhan Date: Mon, 12 Jan 2026 10:13:45 +0800 Subject: [PATCH] fix ble scan non_utf8 deviceName Signed-off-by: liuhan --- ohos/bluetooth/ble/util.cj | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ohos/bluetooth/ble/util.cj b/ohos/bluetooth/ble/util.cj index 3946720..1941154 100644 --- a/ohos/bluetooth/ble/util.cj +++ b/ohos/bluetooth/ble/util.cj @@ -930,12 +930,18 @@ struct NativeScanResult { ) {} func toObject(): ScanResult { + var name: String + try { + name = deviceName.toString() + } catch (_) { + name = "" + } unsafe { ScanResult( deviceId.toString(), rssi, cArr2cjArr(data.size, data.head, {i => i}), - deviceName.toString(), + name, connectable ) }