Hi,
In one of my scripts I use pxwsa to get info from a website.
But some characters had a html code, so you need to convert it, what cost lots of time,
So a little help;
for a,b in ConvertHTML do
if sDirector then
sDirector= string.gsub(sDirector,a,b);
end
end
ConvertHTML = {
["""] = '"', ["&"] = "&", ["À"] = "?", ["Á"] = "?",
["Â"] = "?", ["Ã"] = "?", ["Ä"] = "?", ["Å"] = "?",
["Æ"] = "?", ["Ç"] = "?", ["È"] = "?", ["É"] = "?",
["Ê"] = "?", ["Ë"] = "?", ["Ì"] = "?", ["Í"] = "?",
["Î"] = "?", ["Ï"] = "?", ["Ð"] = "?", ["Ñ"] = "?",
["Ò"] = "?", ["Ó"] = "?", ["Ô"] = "?", ["Õ"] = "?",
["Ö"] = "?", ["Ø"] = "?", ["Ù"] = "?", ["Ú"] = "?",
["Û"] = "?", ["Ü"] = "?", ["Ý"] = "?", ["Þ"] = "?",
["ß"] = "?", ["à"] = "?", ["á"] = "?", ["â"] = "?",
["ã"] = "?", ["ä"] = "?", ["å"] = "?", ["æ"] = "?",
["ç"] = "?", ["è"] = "?", ["é"] = "?", ["ê"] = "?",
["ë"] = "?", ["ì"] = "?", ["í"] = "?", ["î"] = "?",
["ï"] = "?", ["ð"] = "?", ["ð"] = "?", ["ñ"] = "?",
["ò"] = "?", ["ó"] = "?", ["ô"] = "?", ["õ"] = "?",
["ö"] = "?", ["÷"] = "?", ["ø"] = "?", ["ù"] = "?",
["ú"] = "?", ["û"] = "?", ["ü"] = "?", ["ý"] = "?",
["þ"] = "?", ["ÿ"] = "?",
}
greetz
Isn't this easier and faster with string.gfind("(%&%#.+%:)") and hashing?
Quote from: bastya_elvtars on 02 February, 2007, 17:16:41
Isn't this easier and faster with string.gfind("(%&%#.+%:)") and hashing?
Yes you're right, thnx for the tip :)
Care to show us your work then? :)
something like this?
ConvertFeed = function(fFeed)
for txt in string.gfind(fFeed,"(%&%#.+%;)") do
for a,b in ConvertHTML do
fFeed = string.gsub(txt,a,b)
end
end
return fFeed
end
No, fFeed[txt]