You'll be mad but I have to inform, not only HTMLDecode,
UTF8Decode have a bug
I search and look and no find any report...
that's why I do , please read this ...
The idea is that the entire text to be translated in UTF8 to Windows 1252, as original author good say.
But what happens when the text is mixed with various codes, such as utf8 + win1252 + ...
sometimes it is impossible to know what type of encoding is.
Then the function UTF8Decode translates what is in UTF8,
GOOD, and when it is not UTF8 put a "?",
OK,
but when there is text in ASCII (extended) does not agree, and instead of placing a "?" return an empty string!
wrong...
This is very serious, when the idea, in my opinion, is that Translates or Replace the character only, as does StringReplace (),
whether it is acceptable or to put a "?", but not destroy the whole string...
(well... 'destroy' is a way of saying...)
An example to illustrate:
Code: Select all
str := 'ChäoS Walküre Seisô Hen'
str := UTF8Decode(str); //'ChäoS Walküre Seisô Hen'
str := UTF8Decode(str); // ''
Using this little code it is clear that UTF8Decode not like the ASCII extended in range of 128-255:
Code: Select all
program NewScript;
var
code,decode,lastDecode,dummy:string;
totalErrors,totalDecodes:string;
i,nError,nSuccess:integer;
begin
PickListClear;
PickTreeClear;
PickTreeAdd('Success Decodes','');
nError:=0;
nSuccess:=0;
for i:=1 to 255 do begin // ASCII (extended) range
code:='&#'+IntToStr(i)+';'; // HTML number for HTMLDecode
decode:=Copy(code,1,length(code));
HTMLDecode(decode);
lastDecode:=Copy(decode,1,length(decode));
decode:=UTF8Decode(decode);
if (decode = '') then begin // If is empty then UTF8Decode Fails
nError:=nError+1;
PickListAdd(IntToStr(nError)+') '+code+' = '+lastDecode);
end else begin
nSuccess:=nSuccess+1;
PickTreeAdd(IntToStr(nSuccess)+') '+code+' = '+lastDecode+' -> '+decode,'dummy');
end;
end;
PickListExec('Failure Decodes',dummy);
PickTreeExec(dummy);
PickTreeClear;
PickListClear;
end.
Again, I not looking to give me the reason or the fifth leg of cat, but for me this is a serious problem...
For this you must add more code, and control over processes by this problem.
I just hope to help the authors of the program so that in future versions of these problems
are solved.
The Ant Movie Catalog is
GREAT, and I hope this helps somewhat
cya