INI File Processing Improvements

Dmitry Timoshkov dmitry at baikal.ru
Sat Jan 24 01:09:08 CST 2004


"Robert Shearman" <R.J.Shearman at warwick.ac.uk> wrote:

> - Add Unicode file detection

> +static inline ENCODING PROFILE_DetectTextEncoding(const void * buffer)
> +{
> +    if (!memcmp(buffer, bom_utf8, sizeof(bom_utf8)/sizeof(bom_utf8[0])))
> +        return ENCODING_UTF8;
> +    if (*(WCHAR*)buffer == BOM_UTF16LE)
> +        return ENCODING_UTF16LE;
> +    if (*(WCHAR*)buffer == BOM_UTF16BE)
> +        return ENCODING_UTF16BE;
> +    if (*(DWORD*)buffer == BOM_UTF32LE)
> +        return ENCODING_UTF32LE;
> +    if (*(DWORD*)buffer == BOM_UTF32BE)
> +        return ENCODING_UTF32BE;
> +    return ENCODING_ANSI;
> +}

Why not simply use IsTextUnicode/RtlIsTextUnicode and fix it if necessary?

-- 
Dmitry.





More information about the wine-devel mailing list