cPanel API 2 Functions - Encoding::guess_file_opts

Warning:

The cPanel API 2 system is deprecated. We strongly recommend that you use UAPI instead of cPanel API 2.


Description

This function retrieves a list of available file character encodings.

Warning:

We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.

Examples


WHM API (JSON)

https://hostname.example.com:2087/cpsess##########/json-api/cpanel?cpanel_jsonapi_user=user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Encoding&cpanel_jsonapi_func=guess_file_opts&file=public_html/index.html
Note:

For more information, read our Calls from the WHM API documentation.

LiveAPI PHP Class

$cpanel = new CPANEL(); // Connect to cPanel - only do this once.

// Retrieve encoding for the passwd file.
$get_encodings = $cpanel->api2(
    'Encoding', 'guess_file_opts',
        array (
            'file'              => 'public_html/index.html',

    )
);
Note:

For more information, read our Guide to the LiveAPI System.

LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.

# Retrieve encoding for the passwd file.
my $get_encodings = $cpliveapi->api2(
    'Encoding', 'guess_file_opts'
        array {
            'file'              => 'public_html/index.html',
 );
Note:

For more information, read our Guide to the LiveAPI System.

cPanel Tag System (deprecated)

Warnings:
  • cPanel tags are deprecated . We strongly recommend that you only use the LiveAPI system to call the cPanel APIs. Examples are only present in order to help developers move from the old cPanel tag system to our LiveAPI .
  • cPanel API 2 calls that use cPanel tags vary in code syntax and in their output.

Command Line

cpapi2 --user=username Encoding guess_file_opts file=public_html%2Findex.html
Notes:
  • You must URI-encode values.
  • username represents your account-level username.
  • You must include the --user=username option.
  • For more information and additional output options, read our Guide to cPanel API 2 documentation or run the cpapi2 --help command.
  • If you run CloudLinux™, you must use the full path of the cpapi2 command:
    /usr/local/cpanel/bin/cpapi2

Output (JSON)

{
  "cpanelresult": {
    "apiversion": 2,
    "func": "guess_file_opts",
    "data": [
      {
        "map": "ansi_x3.110-1983",
        "selected": ""
      },
      {
        "map": "ansi_x3.4-1968",
        "selected": ""
      },
      {
        "map": "armscii-8",
        "selected": ""
      },
      {
        "map": "asmo_449",
        "selected": ""
      },
      {
        "map": "big5",
        "selected": ""
      },
      {
        "map": "big5-hkscs",
        "selected": ""
      },
      {
        "map": "bs_4730",
        "selected": ""
      },
      {
        "map": "bs_viewdata",
        "selected": ""
      },
      {
        "map": "cp10007",
        "selected": ""
      },
      {
        "map": "cp1125",
        "selected": ""
      },
      {
        "map": "cp1250",
        "selected": ""
      },
      {
        "map": "cp1253",
        "selected": ""
      },
      {
        "map": "cp1254",
        "selected": ""
      },
      {
        "map": "cp1255",
        "selected": ""
      },
      {
        "map": "cp1256",
        "selected": ""
      },
      {
        "map": "cp1257",
        "selected": ""
      },
      {
        "map": "cp1258",
        "selected": ""
      },
      {
        "map": "cp737",
        "selected": ""
      },
      {
        "map": "cp775",
        "selected": ""
      },
      {
        "map": "csa_z243.4-1985-1",
        "selected": ""
      },
      {
        "map": "csa_z243.4-1985-2",
        "selected": ""
      },
      {
        "map": "csa_z243.4-1985-gr",
        "selected": ""
      },
      {
        "map": "csn_369103",
        "selected": ""
      },
      {
        "map": "cwi",
        "selected": ""
      },
      {
        "map": "dec-mcs",
        "selected": ""
      },
      {
        "map": "din_66003",
        "selected": ""
      },
      {
        "map": "ds_2089",
        "selected": ""
      },
      {
        "map": "ebcdic-at-de",
        "selected": ""
      },
      {
        "map": "ebcdic-at-de-a",
        "selected": ""
      },
      {
        "map": "ebcdic-ca-fr",
        "selected": ""
      },
      {
        "map": "ebcdic-dk-no",
        "selected": ""
      },
      {
        "map": "ebcdic-dk-no-a",
        "selected": ""
      },
      {
        "map": "ebcdic-es",
        "selected": ""
      },
      {
        "map": "ebcdic-es-a",
        "selected": ""
      },
      {
        "map": "ebcdic-es-s",
        "selected": ""
      },
      {
        "map": "ebcdic-fi-se",
        "selected": ""
      },
      {
        "map": "ebcdic-fi-se-a",
        "selected": ""
      },
      {
        "map": "ebcdic-fr",
        "selected": ""
      },
      {
        "map": "ebcdic-is-friss",
        "selected": ""
      },
      {
        "map": "ebcdic-it",
        "selected": ""
      },
      {
        "map": "ebcdic-pt",
        "selected": ""
      },
      {
        "map": "ebcdic-uk",
        "selected": ""
      },
      {
        "map": "ebcdic-us",
        "selected": ""
      },
      {
        "map": "ecma-cyrillic",
        "selected": ""
      },
      {
        "map": "es",
        "selected": ""
      },
      {
        "map": "es2",
        "selected": ""
      },
      {
        "map": "euc-jisx0213",
        "selected": ""
      },
      {
        "map": "euc-jp",
        "selected": ""
      },
      {
        "map": "euc-jp-ms",
        "selected": ""
      },
      {
        "map": "euc-kr",
        "selected": ""
      },
      {
        "map": "euc-tw",
        "selected": ""
      },
      {
        "map": "gb18030",
        "selected": ""
      },
      {
        "map": "gb2312",
        "selected": ""
      },
      {
        "map": "gb_1988-80",
        "selected": ""
      },
      {
        "map": "gbk",
        "selected": ""
      },
      {
        "map": "georgian-academy",
        "selected": ""
      },
      {
        "map": "georgian-ps",
        "selected": ""
      },
      {
        "map": "gost_19768-74",
        "selected": ""
      },
      {
        "map": "greek-ccitt",
        "selected": ""
      },
      {
        "map": "greek7",
        "selected": ""
      },
      {
        "map": "greek7-old",
        "selected": ""
      },
      {
        "map": "gsm03.38",
        "selected": ""
      },
      {
        "map": "hp-roman8",
        "selected": ""
      },
      {
        "map": "hz-gb-2312",
        "selected": ""
      },
      {
        "map": "ibm037",
        "selected": ""
      },
      {
        "map": "ibm038",
        "selected": ""
      },
      {
        "map": "ibm1004",
        "selected": ""
      },
      {
        "map": "ibm1026",
        "selected": ""
      },
      {
        "map": "ibm1047",
        "selected": ""
      },
      {
        "map": "ibm1124",
        "selected": ""
      },
      {
        "map": "ibm1129",
        "selected": ""
      },
      {
        "map": "ibm1132",
        "selected": ""
      },
      {
        "map": "ibm1133",
        "selected": ""
      },
      {
        "map": "ibm1160",
        "selected": ""
      },
      {
        "map": "ibm1161",
        "selected": ""
      },
      {
        "map": "ibm1162",
        "selected": ""
      },
      {
        "map": "ibm1163",
        "selected": ""
      },
      {
        "map": "ibm1164",
        "selected": ""
      },
      {
        "map": "ibm256",
        "selected": ""
      },
      {
        "map": "ibm273",
        "selected": ""
      },
      {
        "map": "ibm274",
        "selected": ""
      },
      {
        "map": "ibm275",
        "selected": ""
      },
      {
        "map": "ibm277",
        "selected": ""
      },
      {
        "map": "ibm278",
        "selected": ""
      },
      {
        "map": "ibm280",
        "selected": ""
      },
      {
        "map": "ibm281",
        "selected": ""
      },
      {
        "map": "ibm284",
        "selected": ""
      },
      {
        "map": "ibm285",
        "selected": ""
      },
      {
        "map": "ibm290",
        "selected": ""
      },
      {
        "map": "ibm297",
        "selected": ""
      },
      {
        "map": "ibm420",
        "selected": ""
      },
      {
        "map": "ibm423",
        "selected": ""
      },
      {
        "map": "ibm424",
        "selected": ""
      },
      {
        "map": "ibm437",
        "selected": ""
      },
      {
        "map": "ibm500",
        "selected": ""
      },
      {
        "map": "ibm850",
        "selected": ""
      },
      {
        "map": "ibm851",
        "selected": ""
      },
      {
        "map": "ibm852",
        "selected": ""
      },
      {
        "map": "ibm855",
        "selected": ""
      },
      {
        "map": "ibm856",
        "selected": ""
      },
      {
        "map": "ibm857",
        "selected": ""
      },
      {
        "map": "ibm860",
        "selected": ""
      },
      {
        "map": "ibm861",
        "selected": ""
      },
      {
        "map": "ibm862",
        "selected": ""
      },
      {
        "map": "ibm863",
        "selected": ""
      },
      {
        "map": "ibm864",
        "selected": ""
      },
      {
        "map": "ibm865",
        "selected": ""
      },
      {
        "map": "ibm866",
        "selected": ""
      },
      {
        "map": "ibm866nav",
        "selected": ""
      },
      {
        "map": "ibm868",
        "selected": ""
      },
      {
        "map": "ibm869",
        "selected": ""
      },
      {
        "map": "ibm870",
        "selected": ""
      },
      {
        "map": "ibm871",
        "selected": ""
      },
      {
        "map": "ibm874",
        "selected": ""
      },
      {
        "map": "ibm875",
        "selected": ""
      },
      {
        "map": "ibm880",
        "selected": ""
      },
      {
        "map": "ibm891",
        "selected": ""
      },
      {
        "map": "ibm903",
        "selected": ""
      },
      {
        "map": "ibm904",
        "selected": ""
      },
      {
        "map": "ibm905",
        "selected": ""
      },
      {
        "map": "ibm918",
        "selected": ""
      },
      {
        "map": "ibm922",
        "selected": ""
      },
      {
        "map": "iec_p27-1",
        "selected": ""
      },
      {
        "map": "inis",
        "selected": ""
      },
      {
        "map": "inis-8",
        "selected": ""
      },
      {
        "map": "inis-cyrillic",
        "selected": ""
      },
      {
        "map": "invariant",
        "selected": ""
      },
      {
        "map": "isiri-3342",
        "selected": ""
      },
      {
        "map": "iso-8859-1",
        "selected": ""
      },
      {
        "map": "iso-8859-10",
        "selected": ""
      },
      {
        "map": "iso-8859-11",
        "selected": ""
      },
      {
        "map": "iso-8859-13",
        "selected": ""
      },
      {
        "map": "iso-8859-14",
        "selected": ""
      },
      {
        "map": "iso-8859-15",
        "selected": ""
      },
      {
        "map": "iso-8859-16",
        "selected": ""
      },
      {
        "map": "iso-8859-2",
        "selected": ""
      },
      {
        "map": "iso-8859-3",
        "selected": ""
      },
      {
        "map": "iso-8859-4",
        "selected": ""
      },
      {
        "map": "iso-8859-5",
        "selected": ""
      },
      {
        "map": "iso-8859-6",
        "selected": ""
      },
      {
        "map": "iso-8859-7",
        "selected": ""
      },
      {
        "map": "iso-8859-8",
        "selected": ""
      },
      {
        "map": "iso-8859-9",
        "selected": ""
      },
      {
        "map": "iso-ir-197",
        "selected": ""
      },
      {
        "map": "iso-ir-209",
        "selected": ""
      },
      {
        "map": "iso-ir-90",
        "selected": ""
      },
      {
        "map": "iso_10367-box",
        "selected": ""
      },
      {
        "map": "iso_10646",
        "selected": ""
      },
      {
        "map": "iso_11548-1",
        "selected": ""
      },
      {
        "map": "iso_2033-1983",
        "selected": ""
      },
      {
        "map": "iso_5427",
        "selected": ""
      },
      {
        "map": "iso_5427-ext",
        "selected": ""
      },
      {
        "map": "iso_5428",
        "selected": ""
      },
      {
        "map": "iso_646.basic",
        "selected": ""
      },
      {
        "map": "iso_646.irv",
        "selected": ""
      },
      {
        "map": "iso_6937",
        "selected": ""
      },
      {
        "map": "iso_6937-2-25",
        "selected": ""
      },
      {
        "map": "iso_6937-2-add",
        "selected": ""
      },
      {
        "map": "iso_8859-1,gl",
        "selected": ""
      },
      {
        "map": "iso_8859-supp",
        "selected": ""
      },
      {
        "map": "it",
        "selected": ""
      },
      {
        "map": "jis_c6220-1969-jp",
        "selected": ""
      },
      {
        "map": "jis_c6220-1969-ro",
        "selected": ""
      },
      {
        "map": "jis_c6229-1984-a",
        "selected": ""
      },
      {
        "map": "jis_c6229-1984-b",
        "selected": ""
      },
      {
        "map": "jis_c6229-1984-b-add",
        "selected": ""
      },
      {
        "map": "jis_c6229-1984-hand",
        "selected": ""
      },
      {
        "map": "jis_c6229-1984-hand-add",
        "selected": ""
      },
      {
        "map": "jis_c6229-1984-kana",
        "selected": ""
      },
      {
        "map": "jis_x0201",
        "selected": ""
      },
      {
        "map": "johab",
        "selected": ""
      },
      {
        "map": "jus_i.b1.002",
        "selected": ""
      },
      {
        "map": "jus_i.b1.003-mac",
        "selected": ""
      },
      {
        "map": "jus_i.b1.003-serb",
        "selected": ""
      },
      {
        "map": "koi-8",
        "selected": ""
      },
      {
        "map": "koi8-r",
        "selected": ""
      },
      {
        "map": "koi8-t",
        "selected": ""
      },
      {
        "map": "koi8-u",
        "selected": ""
      },
      {
        "map": "ks_c_5601-1987",
        "selected": ""
      },
      {
        "map": "ksc5636",
        "selected": ""
      },
      {
        "map": "latin-greek",
        "selected": ""
      },
      {
        "map": "latin-greek-1",
        "selected": ""
      },
      {
        "map": "mac-cyrillic",
        "selected": ""
      },
      {
        "map": "mac-is",
        "selected": ""
      },
      {
        "map": "mac-sami",
        "selected": ""
      },
      {
        "map": "mac-uk",
        "selected": ""
      },
      {
        "map": "macintosh",
        "selected": ""
      },
      {
        "map": "mik",
        "selected": ""
      },
      {
        "map": "msz_7795.3",
        "selected": ""
      },
      {
        "map": "nats-dano",
        "selected": ""
      },
      {
        "map": "nats-dano-add",
        "selected": ""
      },
      {
        "map": "nats-sefi",
        "selected": ""
      },
      {
        "map": "nats-sefi-add",
        "selected": ""
      },
      {
        "map": "nc_nc00-10",
        "selected": ""
      },
      {
        "map": "nextstep",
        "selected": ""
      },
      {
        "map": "nf_z_62-010",
        "selected": ""
      },
      {
        "map": "nf_z_62-010_1973",
        "selected": ""
      },
      {
        "map": "ns_4551-1",
        "selected": ""
      },
      {
        "map": "ns_4551-2",
        "selected": ""
      },
      {
        "map": "pt",
        "selected": ""
      },
      {
        "map": "pt154",
        "selected": ""
      },
      {
        "map": "pt2",
        "selected": ""
      },
      {
        "map": "rk1048",
        "selected": ""
      },
      {
        "map": "sami",
        "selected": ""
      },
      {
        "map": "sami-ws2",
        "selected": ""
      },
      {
        "map": "sen_850200_b",
        "selected": ""
      },
      {
        "map": "sen_850200_c",
        "selected": ""
      },
      {
        "map": "shift_jis",
        "selected": ""
      },
      {
        "map": "shift_jisx0213",
        "selected": ""
      },
      {
        "map": "t.101-g2",
        "selected": ""
      },
      {
        "map": "t.61-7bit",
        "selected": ""
      },
      {
        "map": "t.61-8bit",
        "selected": ""
      },
      {
        "map": "tcvn5712-1",
        "selected": ""
      },
      {
        "map": "tis-620",
        "selected": ""
      },
      {
        "map": "tscii",
        "selected": ""
      },
      {
        "map": "us-ascii",
        "selected": ""
      },
      {
        "map": "utf-7",
        "selected": ""
      },
      {
        "map": "utf-8",
        "selected": "selected"
      },
      {
        "map": "videotex-suppl",
        "selected": ""
      },
      {
        "map": "viscii",
        "selected": ""
      },
      {
        "map": "windows-1251",
        "selected": ""
      },
      {
        "map": "windows-1252",
        "selected": ""
      },
      {
        "map": "windows-31j",
        "selected": ""
      }
    ],
    "event": {
      "result": 1
    },
    "module": "Encoding"
  }
}
Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.


Parameters

Parameter Type Description Possible values Example
file string

Required

The file's path.

Any valid file path, relative to the /home directory. public_html/index.html

Returns

Return Type Description Possible values Example
map string A cPanel-supported character encoding. Any cPanel-supported character encoding. ansi_x3.110-1983
selected string Whether the file uses the character encoding. selected
reason string

A reason for failure.

This function only returns a reason value if there was an error.

A string that describes the error. This is an error message.
result Boolean

Whether the function succeeded.


  • 1 — The function succeeded.
  • 0 — The function failed.
1