Good theory, but.

See my last posting where I have included both the qencode and the
qdecode function.  The qencode may indeed wrap through the ascii code
table but, where I am running the left function the values have already
been decoded (de-shifted).  All I am trying to do is to get rid of the
random number on the end.



The values I am inputting is:
Input                 Encoded                       Output
TID=1                WLG%286G45 TID=1
TID=2                WLG%286G5%3A         TID=2
TID=3                WLG%286G63 TID=3
TID=4                WLG%286G73              TID=4
TID=5                WLG%286G84              TID=5
TID=6                WLG%286G93 TID=6
TID=7                WLG%286G%3A6         TID=7
TID=8                WLG%286G%3B9         TID=8
TID=9                WLG%286G%3C3         TID=9
TID=10  WLG%286G437             TID=10

#qencode('TID=1')# should return "WLG%286G45" then
#qdecode('WLG%286G45')# should return the starting value of "TID=1".

Mark W. Breneman
-Cold Fusion Developer
-Network Administrator
  Vivid Media
  [EMAIL PROTECTED]
  www.vividmedia.com
  608.270.9770

-----Original Message-----
From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 08, 2003 3:50 PM
To: CF-Talk
Subject: RE: Ok, I give up UDF error

Actually, I tried this function and it works fine for me.  What are you
passing into the function? what's the purpose?
Here's a test that passes in cgi.query_string

gives a cryptic strring as a return.
http://dev.mxconsulting.com/sergv2/testSTringUdf.cfm?object=true

Throws an error:
http://dev.mxconsulting.com/sergv2/testSTringUdf.cfm

Throws an error:
http://dev.mxconsulting.com/sergv2/testSTringUdf.cfm?o

If the string is less than 1 character long it throws an error.

I can only assume that something is crazy about the value being passed
IN to the function.

This function appears to take items and shift the ascii character code
value 3 to the left.  I'm guessing that the ascii
character code in some cases is less than 3 causing some sort of end
marker to be placed and thus befuddling your
"len( )".
I would do something like:

if(tempStr LT 4)
    tempStr = tempStr + 254;

Then your values would "wrap" through the ascii code table.

-Mark

  -----Original Message-----
  From: Calvin Ward [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 08, 2003 3:16 PM
  To: CF-Talk
  Subject: Re: Ok, I give up UDF error

  What does this do for you?

  <cfscript>
  function qdecode(urlvars){
              var tempurlvars = URLDecode(urlvars);
              var strlen = len(tempurlvars);
              var tempstr = "";
              var i = 1;
              var newstr = "";
              for(i=1;i lte strlen;i=i+1) {
                          tempstr = Asc(Mid(tempurlvars, i, 1));
                          newstr = newstr & Chr(tempstr - 3);
              }
     strReturn = 'Too Short:' & newstr & ':end';
     if (len(newstr)+1)
      strReturn = left(newstr,len(newstr)-1);
      }
  </cfscript>

  - Calvin
    ----- Original Message -----
    From: Mark W. Breneman
    To: CF-Talk
    Sent: Wednesday, October 08, 2003 3:52 PM
    Subject: RE: Ok, I give up UDF error

    Good question, but no, I have ran the output several times and
checked
    all values none are blank.

    Mark W. Breneman
    -Cold Fusion Developer
    -Network Administrator
      Vivid Media
      [EMAIL PROTECTED]
      www.vividmedia.com
      608.270.9770

    -----Original Message-----
    From: Matthew Walker [mailto:[EMAIL PROTECTED]
    Sent: Wednesday, October 08, 2003 2:44 PM
    To: CF-Talk
    Subject: Re: Ok, I give up UDF error

    Is your input string empty?
      ----- Original Message -----
      From: Mark W. Breneman
      To: CF-Talk
      Sent: Thursday, October 09, 2003 8:37 AM
      Subject: Ok, I give up UDF error

      This seems so simple. All I want to do is to trim the last char
from
    the
      return string.  I keep getting this error "Parameter 2 of function
    Left
      which is now -1 must be a positive integer"

      If I hard code a value in the UDF works with out a problem.  But
when
    I
      put in the len(newstr)-1  into the "left" function it seems to
    evaluate
      to 0.

      Can anyone help me out?

      <cfscript>

      function qdecode(urlvars){

                  var tempurlvars = URLDecode(urlvars);

                  var strlen = len(tempurlvars);

                  var tempstr = "";

                  var i = 1;

                  var newstr = "";

                  for(i=1;i lte strlen;i=i+1) {

                              tempstr = Asc(Mid(tempurlvars, i, 1));

                              newstr = newstr & Chr(tempstr - 3);

                  }

                  return left(newstr,len(newstr)-1);

      }

      </cfscript>

      Mark W. Breneman

      -Cold Fusion Developer

      -Network Administrator

        Vivid Media

        [EMAIL PROTECTED]

        www.vividmedia.com

        608.270.9770

      _____


  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to