Commit e846da32 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Convert old-Mac-style line breaks (CR) to Windows-style CRLF when importing UTF-16.

At least one Mac app, TextWrangler, puts UTF-16 data on the pasteboard with lines separated by CR (although it uses LF for the UTF-8 form of the same text). Other Mac apps handle it properly; we should, too. Signed-off-by: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 861541c5
......@@ -1176,6 +1176,8 @@ static HANDLE import_utf16_to_unicodetext(CFDataRef data)
{
if (src[i] == '\n')
new_lines++;
else if (src[i] == '\r' && (i + 1 >= src_len || src[i + 1] != '\n'))
new_lines++;
}
if ((unicode_handle = GlobalAlloc(GMEM_FIXED, (src_len + new_lines + 1) * sizeof(WCHAR))))
......@@ -1188,6 +1190,9 @@ static HANDLE import_utf16_to_unicodetext(CFDataRef data)
dst[j++] = '\r';
dst[j++] = src[i];
if (src[i] == '\r' && (i + 1 >= src_len || src[i + 1] != '\n'))
dst[j++] = '\n';
}
dst[j] = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment