bytes.to_text
bytes.to_text
Function
Convert Bytes to string strictly as UTF-8.
Syntax
bytes(value).to_text()
Parameters
No parameters.
Return value
| Type | Description |
|---|---|
| String/Null | Legal UTF-8 returns String; illegal UTF-8 returns null. |
Code Example
data = bytes([66, 84]) text = data.to_text() // Output: BT print text
Notes
-
to_text()will not use lossy conversion; device protocols or network messages should be observed first usingto_hex(),to_array()or protocol parsing functions.