• Encode a utf8 string to a buffer that encoding with GBK, GB18030, GB2132, ISO8859_1 .etc

    Parameters

    • content: string

      the utf8 string

    • encoding: string

      the encoding method: GBK, GB18030, GB2132, ISO8859_1

    Returns Bytes

    Example


    import * as iconv from 'iconv';
    let result = iconv.encode('hello 中国', 'GBK');