Child pages
  • cPanel API 2 Functions - Encoding::guess_file_opts

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Description

Excerpt

This function retrieves a file's encoding and a list of all cPanel-supported character encodings.

Include Page
LIB:_cPanelAPI2NoEquivalent
LIB:_cPanelAPI2NoEquivalent


Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleWHM API (JSON)


Code Block
languagetext
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

Include Page
LIB:_CallFromWHMAPILink
LIB:_CallFromWHMAPILink


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$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',

    ) 
);

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink

 


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
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',
 );

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink

 


Expand
titlecPanel Tag System (deprecated)

Include Page
LIB:_cPanelAPI2cPanelTagsWarning
LIB:_cPanelAPI2cPanelTagsWarning


Expand
titleCommand Line


Code Block
languagetext
cpapi2 --user=username Encoding guess_file_opts file=public_html%2Findex.html

Include Page
LIB:_cPanelAPI2CLINote
LIB:_cPanelAPI2CLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
  "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"
  }
}


Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample
filestring

Required

The file's path.

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

 

Returns

ReturnTypeDescriptionPossible valuesExample
mapstringA cPanel-supported character encoding.Any cPanel-supported character encoding.ansi_x3.110-1983
selectedstringWhether the file uses the character encoding.selected
reasonstring

A reason for failure.

Note
-titled
titleNote:

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


 A string that describes the error.This is an error message.
resultBoolean

Whether the function succeeded.

 

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