Buffer.encoding read/write property



The Buffer.encoding property get or set the encoding to be used when converting the Buffer to a string

Example

-- init a Buffer with the unicode string "Héllo" local buff = sys.Buffer("Héllo", "unicode") -- prints the buffer as a string using "unicode" encoding print(buff.encoding, "=>", buff) -- change buffer encoding to "utf8" buff.encoding = "utf8" -- prints the buffer as a string using "utf8" encoding print(buff.encoding, "=>", buff)