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
678fbc17
Commit
678fbc17
authored
Oct 30, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Hint parser to use UTF-8 if it's specfied as BOM.
parent
1e998bfc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
saxreader.c
dlls/msxml3/saxreader.c
+21
-0
No files found.
dlls/msxml3/saxreader.c
View file @
678fbc17
...
...
@@ -1770,6 +1770,8 @@ static HRESULT SAXLocator_create(saxreader *reader, saxlocator **ppsaxlocator, B
/*** SAXXMLReader internal functions ***/
static
HRESULT
internal_parseBuffer
(
saxreader
*
This
,
const
char
*
buffer
,
int
size
,
BOOL
vbInterface
)
{
xmlCharEncoding
encoding
=
XML_CHAR_ENCODING_NONE
;
xmlChar
*
enc_name
=
NULL
;
saxlocator
*
locator
;
HRESULT
hr
;
...
...
@@ -1777,6 +1779,22 @@ static HRESULT internal_parseBuffer(saxreader *This, const char *buffer, int siz
if
(
FAILED
(
hr
))
return
hr
;
if
(
size
>=
4
)
{
const
unsigned
char
*
buff
=
(
unsigned
char
*
)
buffer
;
encoding
=
xmlDetectCharEncoding
((
xmlChar
*
)
buffer
,
4
);
enc_name
=
(
xmlChar
*
)
xmlGetCharEncodingName
(
encoding
);
TRACE
(
"detected encoding: %s
\n
"
,
enc_name
);
/* skip BOM, parser won't switch encodings and so won't skip it on its own */
if
((
encoding
==
XML_CHAR_ENCODING_UTF8
)
&&
buff
[
0
]
==
0xEF
&&
buff
[
1
]
==
0xBB
&&
buff
[
2
]
==
0xBF
)
{
buffer
+=
3
;
size
-=
3
;
}
}
locator
->
pParserCtxt
=
xmlCreateMemoryParserCtxt
(
buffer
,
size
);
if
(
!
locator
->
pParserCtxt
)
{
...
...
@@ -1784,6 +1802,9 @@ static HRESULT internal_parseBuffer(saxreader *This, const char *buffer, int siz
return
E_FAIL
;
}
if
(
encoding
==
XML_CHAR_ENCODING_UTF8
)
locator
->
pParserCtxt
->
encoding
=
xmlStrdup
(
enc_name
);
xmlFree
(
locator
->
pParserCtxt
->
sax
);
locator
->
pParserCtxt
->
sax
=
&
locator
->
saxreader
->
sax
;
locator
->
pParserCtxt
->
userData
=
locator
;
...
...
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