DICE PACKS BUNDLE

Thread: xml safe data

  1. #1

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096

    xml safe data

    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.

  2. #2
    I have some badly-written encode/decode routines:
    Code:
    function xmlEncode(value)
      local result = string.gsub(value,"&","&amp;");
      result = string.gsub(result,"<","&lt;");
      result = string.gsub(result,">","&gt;");
      return result;
    end
    
    function xmlDecode(value)
      local result = string.gsub(value,"&gt;",">");
      result = string.gsub(result,"&lt;","<");
      result = string.gsub(result,"&amp;","&");
      return result;
    end
    They're not very efficicent though...

    Stuart

  3. #3

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Thanks, Stuart. I wrote something based on this.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Product Walkthrough Playlist

Log in

Log in