Question

I want that to change is the peripheral name that is shown at iOS Bluetooth settings and in my app, so that user can identify the device.

What I do is:

  1. User writes a name in a UITextField and I get the NSString.
  2. I convert NSString to NSData.
  3. A characteristic is written with the new peripheral name.
  4. Peripheral change GATT device name.

All works fine if I use UTF8 encoding to get NSData, but have problems with tildes, written accents and cyrillic alphabet, because app supports multiple languages. Not sure if problem is with iOS device or peripheral.

My questions:

  1. What encoding should I use?
  2. Is it posible use this characters for names?
  3. What encoding is used for the returned string when peripheral.name is called?
  4. Is there another kind of solution to change the peripheral name that is shown?
Was it helpful?

Solution

The name is encoded in UTF-8 which is in accordance with the specification. UTF-8 is a multibyte coding, so interpreting the byte values as separate characters can lead to unexpected results.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top