[PATCH 2/3] riched20: Added support for UTF8 BOM stream. (Try 2)
Alexandre Julliard
julliard at winehq.org
Thu Aug 16 12:37:41 CDT 2012
Qian Hong <fracting at gmail.com> writes:
> @@ -304,8 +307,19 @@ static LRESULT ME_StreamInText(ME_TextEditor *editor, DWORD dwFormat, ME_InStrea
>
> if (!(dwFormat & SF_UNICODE))
> {
> - /* FIXME? this is doomed to fail on true MBCS like UTF-8, luckily they're unlikely to be used as CP_ACP */
> - nWideChars = MultiByteToWideChar(CP_ACP, 0, stream->buffer, stream->dwSize, wszText, STREAMIN_BUFFER_SIZE);
> + if (!is_read)
> + {
> + is_read = TRUE;
> + if (stream->dwSize >= 3 && !memcmp(stream->buffer, bom_utf8, 3))
> + {
> + cp = CP_UTF8;
> + stream->dwSize -= 3;
> + memmove(stream->buffer, stream->buffer + 3, stream->dwSize);
There's no reason to move the data.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list