"RokuMarkn" wrote:
Since there are tildes in the parameters, they need to be encoded as RokuJoel said. There are three parameters (Expires, Signature, and Key-Pair-Id), so each of the 3 values should be URL encoded.
--Mark
Yes, tildes ("~") should be encoded, according to RFC 1738. However, it appears that UrlEncode () does not encode tildes.
I ran the following code snippet:
ut = CreateObject ("roUrlTransfer")
For c = 0 To 127
ch = Chr (c)
urlEncode = ut.UrlEncode (ch)
If Len (urlEncode) = 1 And ch = urlEncode
Print "Did not encode: " + ch
EndIf
End For
and got the following result:
------ Running ------
Did not encode: -
Did not encode: .
Did not encode: 0
Did not encode: 1
Did not encode: 2
Did not encode: 3
Did not encode: 4
Did not encode: 5
Did not encode: 6
Did not encode: 7
Did not encode: 8
Did not encode: 9
Did not encode: A
Did not encode: B
Did not encode: C
Did not encode: D
Did not encode: E
Did not encode: F
Did not encode: G
Did not encode: H
Did not encode: I
Did not encode: J
Did not encode: K
Did not encode: L
Did not encode: M
Did not encode: N
Did not encode: O
Did not encode: P
Did not encode: Q
Did not encode: R
Did not encode: S
Did not encode: T
Did not encode: U
Did not encode: V
Did not encode: W
Did not encode: X
Did not encode: Y
Did not encode: Z
Did not encode: _
Did not encode: a
Did not encode: b
Did not encode: c
Did not encode: d
Did not encode: e
Did not encode: f
Did not encode: g
Did not encode: h
Did not encode: i
Did not encode: j
Did not encode: k
Did not encode: l
Did not encode: m
Did not encode: n
Did not encode: o
Did not encode: p
Did not encode: q
Did not encode: r
Did not encode: s
Did not encode: t
Did not encode: u
Did not encode: v
Did not encode: w
Did not encode: x
Did not encode: y
Did not encode: z
Did not encode: ~
So it looks like UrlEncode encodes all characters except: hyphen ("-"), underscore ("_"), period ("."), alphanumerics and tilde ("~").
I don't believe this is the correct behavior according to RFC 1738.
Also, when I run the above code using Escape () instead of UrlEncode () I get the exact same output even though they are supposed to encode differently.
Is this a bug, or am I missing something here?