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
127aa62a
Commit
127aa62a
authored
Dec 30, 2014
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 30, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Use document encoding for scripts.
parent
d4afbf5b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
4 deletions
+44
-4
htmldoc.c
dlls/mshtml/htmldoc.c
+32
-0
mshtml_private.h
dlls/mshtml/mshtml_private.h
+4
-0
script.c
dlls/mshtml/script.c
+8
-4
No files found.
dlls/mshtml/htmldoc.c
View file @
127aa62a
...
...
@@ -115,6 +115,38 @@ HRESULT get_doc_elem_by_id(HTMLDocumentNode *doc, const WCHAR *id, HTMLElement *
return
hres
;
}
UINT
get_document_charset
(
HTMLDocumentNode
*
doc
)
{
nsAString
charset_str
;
UINT
ret
=
0
;
nsresult
nsres
;
if
(
doc
->
charset
)
return
doc
->
charset
;
nsAString_Init
(
&
charset_str
,
NULL
);
nsres
=
nsIDOMHTMLDocument_GetCharacterSet
(
doc
->
nsdoc
,
&
charset_str
);
if
(
NS_SUCCEEDED
(
nsres
))
{
const
PRUnichar
*
charset
;
nsAString_GetData
(
&
charset_str
,
&
charset
);
if
(
*
charset
)
{
BSTR
str
=
SysAllocString
(
charset
);
ret
=
cp_from_charset_string
(
str
);
SysFreeString
(
str
);
}
}
else
{
ERR
(
"GetCharset failed: %08x
\n
"
,
nsres
);
}
nsAString_Finish
(
&
charset_str
);
if
(
!
ret
)
return
CP_UTF8
;
return
doc
->
charset
=
ret
;
}
static
inline
HTMLDocument
*
impl_from_IHTMLDocument2
(
IHTMLDocument2
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
HTMLDocument
,
IHTMLDocument2_iface
);
...
...
dlls/mshtml/mshtml_private.h
View file @
127aa62a
...
...
@@ -749,6 +749,8 @@ struct HTMLDocumentNode {
BOOL
skip_mutation_notif
;
UINT
charset
;
struct
list
selection_list
;
struct
list
range_list
;
struct
list
plugin_hosts
;
...
...
@@ -807,6 +809,8 @@ void show_tooltip(HTMLDocumentObj*,DWORD,DWORD,LPCWSTR) DECLSPEC_HIDDEN;
void
hide_tooltip
(
HTMLDocumentObj
*
)
DECLSPEC_HIDDEN
;
HRESULT
get_client_disp_property
(
IOleClientSite
*
,
DISPID
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
UINT
get_document_charset
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
HRESULT
ProtocolFactory_Create
(
REFCLSID
,
REFIID
,
void
**
)
DECLSPEC_HIDDEN
;
BOOL
load_gecko
(
void
)
DECLSPEC_HIDDEN
;
...
...
dlls/mshtml/script.c
View file @
127aa62a
...
...
@@ -904,6 +904,7 @@ static const BSCallbackVtbl ScriptBSCVtbl = {
static
HRESULT
bind_script_to_text
(
HTMLInnerWindow
*
window
,
IUri
*
uri
,
HTMLScriptElement
*
script_elem
,
WCHAR
**
ret
)
{
UINT
cp
=
CP_UTF8
;
ScriptBSC
*
bsc
;
IMoniker
*
mon
;
WCHAR
*
text
;
...
...
@@ -961,18 +962,21 @@ static HRESULT bind_script_to_text(HTMLInnerWindow *window, IUri *uri, HTMLScrip
text
[
bsc
->
bsc
.
readed
/
sizeof
(
WCHAR
)]
=
0
;
break
;
case
BOM_UTF8
:
default:
{
default:
/* FIXME: Try to use charset from HTTP headers first */
cp
=
get_document_charset
(
window
->
doc
);
/* fall through */
case
BOM_UTF8
:
{
DWORD
len
;
len
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
bsc
->
buf
,
bsc
->
bsc
.
readed
,
NULL
,
0
);
len
=
MultiByteToWideChar
(
cp
,
0
,
bsc
->
buf
,
bsc
->
bsc
.
readed
,
NULL
,
0
);
text
=
heap_alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
text
)
{
hres
=
E_OUTOFMEMORY
;
break
;
}
MultiByteToWideChar
(
CP_UTF8
,
0
,
bsc
->
buf
,
bsc
->
bsc
.
readed
,
text
,
len
);
MultiByteToWideChar
(
cp
,
0
,
bsc
->
buf
,
bsc
->
bsc
.
readed
,
text
,
len
);
text
[
len
]
=
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