• Decode the byte buffer that encoding with GBK, GB18030, GB2132, ISO8859_1 .etc to a utf-8 string.

    Parameters

    • buffer: any

      the byte buffer that encoding with GBK, GB18030, GB2132, ISO8859_1 .etc

    • encoding: string

      the encoding method: GBK, GB18030, GB2132, ISO8859_1

    Returns string

    Example


    import * as iconv from 'iconv';
    import * as http from 'http';
    import {Encoding} from 'buffer';

    let client = http.newClient();
    let resp = client.get('xxx.com/login');
    let iconv.decode(resp.data, Encoding.Utf8);