mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 14:50:46 +02:00
*HTML writer: change charset in 'meta' tag (if any) to utf-8, because it is the encoding we actually write.
git-svn-id: trunk@13354 -
This commit is contained in:
parent
67cb961ed3
commit
ccb730c051
@ -336,21 +336,37 @@ var
|
||||
s: string;
|
||||
ElFlags: THTMLElementFlags;
|
||||
j: THTMLElementTag;
|
||||
meta: Boolean;
|
||||
begin
|
||||
if not FInsideTextNode then
|
||||
wrtIndent;
|
||||
|
||||
|
||||
meta := False;
|
||||
s := LowerCase(node.NodeName);
|
||||
ElFlags := [efSubelementContent, efPCDATAContent]; // default flags
|
||||
for j := Low(THTMLElementTag) to High(THTMLElementTag) do
|
||||
if HTMLElementProps[J].Name = s then
|
||||
begin
|
||||
ElFlags := HTMLElementProps[j].Flags;
|
||||
if j = etMeta then
|
||||
meta := True;
|
||||
break;
|
||||
end;
|
||||
|
||||
wrtChr('<');
|
||||
wrtStr(TDOMElement(node).TagName);
|
||||
|
||||
{ Force charset label to utf-8, because it is the encoding we actually write }
|
||||
if meta then
|
||||
begin
|
||||
s := TDOMElement(node).GetAttribute('http-equiv');
|
||||
if SameText(s, 'content-type') then
|
||||
begin
|
||||
wrtStr(' content="text/html; charset=utf-8" http-equiv="Content-Type">');
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
if node.HasAttributes then
|
||||
for i := 0 to node.Attributes.Length - 1 do
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user