Tarantool Lua API

iconv

The iconv module provides a way to convert a string with one encoding to a string with another encoding, for example from ASCII to UTF-8. It is based on the POSIX iconv routines.

An exact list of the available encodings may depend on environment. Typically the list includes ASCII, BIG5, KOI8R, LATIN8, MS-GREEK, SJIS, and about 100 others. For a complete list, type iconv --list on a terminal.

Methods1

function M.new(to: string, from: string) -> converter iconv.converter

Construct a new iconv instance.

If either parameter is not a valid name, there will be an error message.

Example:

tarantool> converter = require('iconv').new('UTF8', 'ASCII')
--
...
Parameters
tostring

The name of the encoding that we will convert to.

fromstring

The name of the encoding that we will convert from.

Returns
convertericonv.converter

A new iconv instance -- in effect, a callable function.