realbasic-nug
[Top] [All Lists]

Re: HTML Encoding code?

To: realbasic-nug at lists dot realsoftware dot com
Subject: Re: HTML Encoding code?
From: "Craig A. Finseth" <fin at finseth dot com>
Date: Tue, 30 Jan 2007 19:18:56 -0600 (CST)
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <A90D5E2B-7654-4377-865F-25C50DBB3A0A at mac dot com>
   Bizarrely, I can't locate any code for REALbasic that converts  
   characters intended for a URL into HTML escape sequences as need be.  
   eg space into %20.

Here is my URL Quoting code:

------------------------------------------------------------
  ' quote the supplied string per URL quoting.  It only works for strings with 
8-bit characters.
  
  dim cnt as Integer = s.Len
  dim i as Integer
  dim ss as String = ""
  dim c as String
  dim ac as Integer
  if cnt > 0 then
    for i = 1 to cnt
      c = s.Mid(i, 1)
      ac = Asc(c)
      if c = " " then
        ss = ss + "+"
      elseif c = "=" or c = "+" or c = "%" or ac < 32 or ac > 126 then
        ss = ss + "%" + Fin.Hex2(ac)
      else
        ss = ss + c
      end
    next
  end
  return ss
------------------------------------------------------------
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>