With size
S This expression returns the string at the cursor's position in the received binary message, reading the specified size.
It takes one parameter, the size in characters of the string to read.
- In Relay, this is in ANSI characters, or bytes.
- In Blue, this is UTF-8 code points, not bytes. Read more here.
If reading was successful, the cursor will be incremented by the size in bytes read.
In case of any error, the expression will return blank.
For Blue, if the content could not fully be read, the cursor will not be incremented at all. If there was invalid Unicode, the cursor will either be incremented fully or not at all, but blank will be returned.
In Blue Server, the Unicode text is tested for validity while reading to some extent; if it contains unreadable Unicode or embedded null characters, the expression will fail with an error. However, the content can be undisplayable even if it's valid; examples include the zero-width space and other Format, Other category Unicode code points.
If you need a more complete test or limitation of content using a Unicode allowlist, you should do the checks on the server side, but there is a Convert string to UTF-8 and check against Unicode allowlist expression on the Server.
In Relay Server, no test is done. If the string contains embedded nulls, whatever reads it will simply be cut off at the first embedded null.
The text sent will be ANSI only in Lacewing Relay, so non-ANSI characters may be corrupted. More details on that here.