Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] x-www-form-urlencoded (bug in bitset! or find ?)

From: alex::pini::mclink::it at: 2-Sep-2000 1:55

>- Open Your Mind -<
I've been examining the url-encode function from CookieClient.r, but there's something I'd most definitely call a bug... if I could manage to pinpoint it! :-0
>> s: copy "" for c #"^(00)" #"^(fe)" 1 [append s c] append s #"^(ff)" >> probe url-encode s
{%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F [%21%22%23%24%25%26%27%28%29*%2B%2C---%2F0123456789%3A%3B%3C%3D%3E%3F--ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E%7F%80%81%83] %8F%91%94%97%98%99%9A%9B%9F ¡¢£%A4¥%A6%A7%A8%A9%AA%AB%AC­%AE%AF%B0±²³´µ%B6%B7%B8¹º»¼½%BE%BF%C0%C1%C2%C3%C4Å%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0Ñ%D2Ó%D4Õ%D6%D7ØÙ%DAÛ%DCÝ%DE%DF%E0%E1âã%E4å%E6%E7è%E9êë%ECí%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF} The result isn't correct (just look at all those unescaped characters beyond "%7F"). Now, don't ask me why, but, in different moments...
>> probe url-encode s
{%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F [%21%22%23%24%25%26%27%28%29*%2B%2C---%2F0123456789%3A%3B%3C%3D%3E%3F--ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E%7F%80] %8E%8F%90%91%92%93%94%95%96%97%9A%9B%9C%9E%9F%A0%A1¢%A3%A4¥%A6%A7¨%A9ª%AB%AC­%AE%AF%B0±²%B3%B4µ%B6%B7¸¹º%BB%BC½%BE%BF%C0%C1%C2Ã%C4Å%C6%C7È%C9%CAË%CCÍ%CE%CF%D0Ñ%D2Ó%D4Õ%D6%D7ØÙ%DAÛ%DCÝ%DE%DF%E0%E1âã%E4å%E6%E7è%E9êë%ECí%EE%EF%F0ñòó%F4õ%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF}
>> probe url-encode s
{%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F [%21%22%23%24%25%26%27%28%29*%2B%2C---%2F0123456789%3A%3B%3C%3D%3E%3F--ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E%7F%80%81%83] %8F%91%94%97%98%99%9A%9B%9F ¡¢£%A4¥%A6%A7%A8%A9%AA%AB%AC­%AE%AF%B0±²³´µ%B6%B7%B8¹º»¼½%BE%BF%C0%C1%C2%C3%C4Å%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF} They're different. Playing around this thing in various ways, I got mixed results, even correct ones :-). At times I seemed to catch a kind of pattern in the bug, but lost it soon after. :-0 I've examined the source several times, but I can't find anything wrong in how it works. I think there's a bug in find and/or in bitsets, because one single time I had this:
>> for c #"^(00)" #"^(fe)" 1 [if find charset "ABC" c [prin c]] prin newline
ABC² (notice the "squared" after the "C"). Tomorrow (after some sleep :-) I'm going to try harder, but in the meantime here's to you antipodeans :-) BTW, is there an *easy* way to get a string from a bitset? For example, to get "123ABCabc" from charset "abcABC123". Alessandro Pini ([alex--pini--mclink--it]) Dexteeeer!!! Get me out of here!!! (Kimberly)