<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Encode an UTF8 String into characteristic</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70309/encode-an-utf8-string-into-characteristic</link><description>Dear Nordic Team, 
 I&amp;#39;d like to inquiry how I am supposed to send a UTF8 string as the value of a characteristic. 
 I am trying to implement the FTMS service and the part I am talking about reads as 
 
 
 I am encoding it like this: 
 
 After encoding</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 Jan 2021 16:37:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70309/encode-an-utf8-string-into-characteristic" /><item><title>RE: Encode an UTF8 String into characteristic</title><link>https://devzone.nordicsemi.com/thread/289506?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 16:37:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:781e8c91-b4bd-41a0-9003-d9ef1f1bf358</guid><dc:creator>daubsi</dc:creator><description>&lt;p&gt;Thanks for seeking clarification on this one!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Encode an UTF8 String into characteristic</title><link>https://devzone.nordicsemi.com/thread/289461?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 14:14:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4756e36e-dce3-483a-b8eb-0cb896d4d75d</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I can confirm that the byte order that you have, is the intended byte order: First one byte &amp;quot;flags&amp;quot;, then one byte &amp;quot;training status&amp;quot;, then n bytes UTF-8 encoded string. For increasing memory addresses. When stored as data for the characteristic.&lt;/p&gt;
&lt;p&gt;Other implementations, and/or byte order physically sent over the air, may differ, but apart from that: This is the byte order to use with our SDK / SoftDevice API, yes.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Encode an UTF8 String into characteristic</title><link>https://devzone.nordicsemi.com/thread/288462?ContentTypeID=1</link><pubDate>Mon, 11 Jan 2021 16:48:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e61e6508-5d63-4941-9c46-d5534c59672b</guid><dc:creator>daubsi</dc:creator><description>&lt;p&gt;Thanks Terje, appreciate! I was confused because of the explicit mentioning of MSB/LSB order in the spec and thought I might reverse the byte order therefore. I am actually printing only 8 bytes in the end. The screenshot just shows the SES IDE where I had it print 32 bytes for an easier oversight. Looking forward to your response!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Encode an UTF8 String into characteristic</title><link>https://devzone.nordicsemi.com/thread/288438?ContentTypeID=1</link><pubDate>Mon, 11 Jan 2021 15:19:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b680bde-17c8-4c6e-b970-5da66d6efc22</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;From what I can figure out, it should be a UTF-8 encoded string, without any additional metadata, and in the &amp;quot;normal&amp;quot; byte order for such a string (e.g. no reversing of the bytes.)&lt;/p&gt;
&lt;p&gt;I.e. the same byte ordering and formatting as the Device Name characteristic of the GAP service, which also holds a UTF-8 encoded string. The only difference being that for the Training Status characteristic there are two octets containing &amp;quot;Flags&amp;quot; and &amp;quot;Training Status&amp;quot; in addition to the string.&lt;/p&gt;
&lt;p&gt;Which means your characteristic value data looks correct as is, with the exception that you are printing 32 bytes and the actual contents of the characteristic should be only the first 8 of those bytes.&lt;/p&gt;
&lt;p&gt;I am reaching out internally, to see if I can confirm this is indeed how it is supposed to work.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>