ipro: Fix non-breaking space character given by numerical value instead of " "; fixes issue #28174.

git-svn-id: trunk@51086 -
This commit is contained in:
wp 2015-12-30 23:16:23 +00:00
parent d4a86c4069
commit 170279af46

View File

@ -2718,6 +2718,7 @@ const
MaxElements = 1024*1024; MaxElements = 1024*1024;
ShyChar = #1; {character used to represent soft-hyphen in strings} ShyChar = #1; {character used to represent soft-hyphen in strings}
NbspChar = #2; {character used to represent no-break space in strings} NbspChar = #2; {character used to represent no-break space in strings}
NbspUtf8 = #194#160; {utf8 code of no-break space character}
WheelDelta = 8; WheelDelta = 8;
const const
@ -3229,7 +3230,10 @@ begin {'Complete boolean eval' must be off}
if not OnUTF8 and (Index1 >= 32) and (Index1 <= 255) then if not OnUTF8 and (Index1 >= 32) and (Index1 <= 255) then
Result := Chr(Index1) Result := Chr(Index1)
else else
begin
Result := UnicodeToUTF8(Index1); Result := UnicodeToUTF8(Index1);
if Result = NbspUTF8 then Result := NbspChar;
end;
end; end;
end else end else
begin begin
@ -3316,12 +3320,25 @@ end;
function NoBreakToSpace(const S: string): string; function NoBreakToSpace(const S: string): string;
var var
P : Integer; P, n : Integer;
begin begin
Result := S; SetLength(Result, Length(S));
for P := length(Result) downto 1 do n := 0;
if Result[P] = NbspChar then P := 1;
Result[P] := ' '; while P <= Length(S) do
begin
inc(n);
if S[P] = NbspChar then
Result[n] := ' '
else if (P < Length(S)) and (S[P] = NbspUtf8[1]) and (S[P+1] = NbspUtf8[2]) then
begin
Result[n] := ' ';
inc(P);
end else
Result[n] := S[P];
inc(P);
end;
SetLength(Result, n);
end; end;
procedure SetRawWordValue(Entry: PIpHtmlElement; const Value: string); procedure SetRawWordValue(Entry: PIpHtmlElement; const Value: string);