Logo Search packages:      
Sourcecode: icu version File versions  Download package

U_STABLE const UCharsetMatch* U_EXPORT2 ucsdet_detect ( UCharsetDetector ucsd,
UErrorCode status 
)

Return the charset that best matches the supplied input data.

Note though, that because the detection only looks at the start of the input data, there is a possibility that the returned charset will fail to handle the full set of input data.

The returned UCharsetMatch object is owned by the UCharsetDetector. It will remain valid until the detector input is reset, or until the detector is closed.

The function will fail if

  • no charset appears to match the data.
  • no input text has been provided

Parameters:
ucsd the charset detector to be used.
status any error conditions are reported back in this variable.
Returns:
a UCharsetMatch representing the best matching charset, or NULL if no charset matches the byte data.
ICU 3.6

Definition at line 91 of file ucsdet.cpp.

References NULL, and U_FAILURE.

{
    if(U_FAILURE(*status)) {
        return NULL;
    }

    return (const UCharsetMatch *) ((CharsetDetector *) ucsd)->detect(*status);
}


Generated by  Doxygen 1.6.0   Back to index