<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.encodingLanguageDetect.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.encodingLanguageDetect</api:function-name><api:suggest>xdmp.encodinglanguagedetect</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>encodinglanguagedetect</api:suggest><api:function-link mode="xquery" fullname="xdmp:encoding-language-detect">/apidoc/8.0/xdmp:encoding-language-detect.xml</api:function-link><api:function mode="javascript" name="encodingLanguageDetect" type="builtin" lib="xdmp" category="Extension" subcategory="Extension" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.encodingLanguageDetect"><api:summary>
  Analyzes binary, text, or XML data and suggests possible pairs of encoding
  and language, with a confidence score for each pair. Scores of 10 and
  above are high confidence recommendations.
  The results are given in order of decreasing score.
  Accuracy may be poor for short documents.
</api:summary><api:params><api:param name="document" type="node()" optional="false"><api:param-description>
    Node to be analyzed for possible encodings and languages.  If the node is
    an XML element or document node, the function takes the string value
    of the specified node (equivalent of <code xmlns="http://www.w3.org/1999/xhtml">fn:string($node)</code>) to
    detect the encoding and language.
  </api:param-description><api:param-name>document</api:param-name><api:param-type>Node</api:param-type></api:param></api:params><api:return class="javascript">Array</api:return><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">If the input is very small (for example, less than two words), then
  this built-in returns the empty sequence.</p>
  <p xmlns="http://www.w3.org/1999/xhtml">For best results, the input should be at least several hundred bytes.</p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
xdmp.encodingLanguageDetect(xdmp.documentGet("/space/appserver/test.sjs"));
=&gt;
[
  {"encoding":"utf-8","language":"en","score":10.4685125490417},
  {"encoding":"utf-8","language":"ro","score":10.2732191159561},
  {"encoding":"utf-8","language":"fr","score":9.73656934079629},
  ...
]
</pre>
</api:example></api:function></api:function-page>