convert html to characters by using pxwsa
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

convert html to characters by using pxwsa

Started by Leun, 02 February, 2007, 14:47:35

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Leun

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

bastya_elvtars

Isn't this easier and faster with string.gfind("(%&%#.+%:)") and hashing?
Everything could have been anything else and it would have just as much meaning.

Leun

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  :)

bastya_elvtars

Everything could have been anything else and it would have just as much meaning.

Leun

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

bastya_elvtars

Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk