utils.utf8convert

Encodes a string into a UTF-8 string

Prototype

s = utils.utf8convert (str)

Description

This encodes a string which is assumed to be non-UTF-8 into a UTF-8 string.

The function returns a string which is the appropriate UTF-8 encoded string.
eg.

print (utils.tohex (utils.utf8convert (string.char (255))))  --> C3BF
This is intended to allow strings in an ANSI code page to be converted into UTF-8. For example, "È" (0xC8) would be converted into 0xC3 0x88.

Lua functions

Topics