Bidmaron
December 27th, 2010, 21:11
Does anyone have routines in lua that take strings and produce xml safe data (that is no & and <) from it (and vice versa)? Just too lazy to write them.
StuartW
December 27th, 2010, 21:30
I have some badly-written encode/decode routines:
function xmlEncode(value)
local result = string.gsub(value,"&","&");
result = string.gsub(result,"<","<");
result = string.gsub(result,">",">");
return result;
end
function xmlDecode(value)
local result = string.gsub(value,">",">");
result = string.gsub(result,"<","<");
result = string.gsub(result,"&","&");
return result;
end
They're not very efficicent though...
Stuart
Bidmaron
December 31st, 2010, 12:25
Thanks, Stuart. I wrote something based on this.
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.