Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
cb8c500e
Commit
cb8c500e
authored
Aug 17, 2012
by
Qian Hong
Committed by
Alexandre Julliard
Aug 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Added support for UTF8 BOM stream.
parent
cb082b90
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
editor.c
dlls/riched20/editor.c
+19
-3
editor.c
dlls/riched20/tests/editor.c
+2
-2
No files found.
dlls/riched20/editor.c
View file @
cb8c500e
...
...
@@ -283,9 +283,10 @@ static ME_TextBuffer *ME_MakeText(void) {
static
LRESULT
ME_StreamInText
(
ME_TextEditor
*
editor
,
DWORD
dwFormat
,
ME_InStream
*
stream
,
ME_Style
*
style
)
{
WCHAR
wszText
[
STREAMIN_BUFFER_SIZE
+
1
];
WCHAR
*
pText
;
LRESULT
total_bytes_read
=
0
;
BOOL
is_read
=
FALSE
;
static
const
char
bom_utf8
[]
=
{
0xEF
,
0xBB
,
0xBF
};
TRACE
(
"%08x %p
\n
"
,
dwFormat
,
stream
);
...
...
@@ -304,8 +305,23 @@ 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
);
WCHAR
wszText
[
STREAMIN_BUFFER_SIZE
+
1
];
char
*
buf
=
stream
->
buffer
;
DWORD
size
=
stream
->
dwSize
;
DWORD
cp
=
CP_ACP
;
if
(
!
is_read
)
{
is_read
=
TRUE
;
if
(
stream
->
dwSize
>=
3
&&
!
memcmp
(
stream
->
buffer
,
bom_utf8
,
3
))
{
cp
=
CP_UTF8
;
buf
+=
3
;
size
-=
3
;
}
}
nWideChars
=
MultiByteToWideChar
(
cp
,
0
,
buf
,
size
,
wszText
,
STREAMIN_BUFFER_SIZE
);
pText
=
wszText
;
}
else
...
...
dlls/riched20/tests/editor.c
View file @
cb8c500e
...
...
@@ -5120,10 +5120,10 @@ static void test_EM_STREAMIN(void)
ok
(
result
==
18
,
"got %ld, expected %d
\n
"
,
result
,
18
);
result
=
SendMessage
(
hwndRichEdit
,
WM_GETTEXT
,
1024
,
(
LPARAM
)
buffer
);
todo_wine
ok
(
result
==
15
,
ok
(
result
==
15
,
"EM_STREAMIN: Test UTF8WithBOM returned %ld, expected 15
\n
"
,
result
);
result
=
strcmp
(
buffer
,
"TestUTF8WithBOM"
);
todo_wine
ok
(
result
==
0
,
ok
(
result
==
0
,
"EM_STREAMIN: Test UTF8WithBOM set wrong text: Result: %s
\n
"
,
buffer
);
ok
(
es
.
dwError
==
0
,
"EM_STREAMIN: Test UTF8WithBOM set error %d, expected %d
\n
"
,
es
.
dwError
,
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment