Page 1 of 1

URLdecode limit expansion.

Posted: 07 Dec 2010 13:36
by SkyFrontier
URLdecode seems to be limited to deal with 2.098 bytes. Can this please be expanded?
Thanks.
---
Reference:

Code: Select all

   $decoded = urldecode(<clipboard>);
   text $decoded;

Code: Select all

   text(urldecode(<clipboard>));

Re: URLdecode limit expansion.

Posted: 07 Dec 2010 14:09
by admin
Not possible. The UrlUnescape Function is limited to INTERNET_MAX_URL_LENGTH (2083):

const int INTERNET_MAX_PATH_LENGTH = 2048;
const int INTERNET_MAX_SCHEME_LENGTH = 32;
const int INTERNET_MAX_URL_LENGTH = INTERNET_MAX_SCHEME_LENGTH + 3 + INTERNET_MAX_PATH_LENGTH;

Re: URLdecode limit expansion.

Posted: 07 Dec 2010 14:35
by SkyFrontier
uncool. :P
Thanks, Don!
---
Workaround:
Using the attached PSPad macro one can split the URLs into groups of 30 - depending on the length of each link this must suffice, but you'll certainly need to do a few adjustments.
LineSplitter_30Lines_PSpadMacro.zip
(214 Bytes) Downloaded 3897 times
After splitting the lines, select each group, go to XY and run the following script:

Code: Select all

    $T = urldecode("<clipboard>");
    new("file.txt", file);
    writefile(<curname>, "$T", , "tu");
-if the generated file has a size = 0 ("zero"), delete it and go back to PSPad and try again, selecting less links (one or two at a time must be fine) and switching to XY > script ("Scripting > Run Script Again" via CKS! :wink: ). Don't forget to regroup lasting links according to what you did...
It's a pain, but did the job.
If you know an easier way, feel free to contribute!

Re: URLdecode limit expansion.

Posted: 07 Dec 2010 17:17
by SkyFrontier
I can't believe I'm doing this (aka "yes, I'm desperate enough to do it!"), part 1:

Code: Select all

rename s, "%20|%21|%22|%23|%24|%25|%26|%27|%28|%29|%2A|%2B|%2C|%2D|%2E|%2F|%30|%31|%32|%33|%34|%35|%36|%37|%38|%39|%3A|%3B|%3C|%3D|%3E|%3F|%40|%41|%42|%43|%44|%45|%46|%47|%48|%49|%4A|%4B|%4C|%4D|%4E|%4F|%50|%51|%52|%53|%54|%55|%56|%57|%58|%59|%5A|%5B|%5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Ñ|Ò|Ó|Ô|Õ|Ö| |Ø|Ù|Ú|Û|Ü|Ý|Þ|ß|à|á|â|ã|ä|å|æ|ç|è|é|ê|ë|ì|í|î|ï|ð|ñ|ò|ó|ô|õ|ö|÷|ø|ù|ú|û|ü|ý|þ|ÿ";
More to come...

Re: URLdecode limit expansion.

Posted: 07 Dec 2010 17:36
by admin
SkyFrontier wrote:I can't believe I'm doing this (aka "yes, I'm desperate enough to do it!"), part 1:

Code: Select all

rename s, ... ... ... <madness> ...
More to come...
Hmm, it seems there is a cleverer way to do this.... also look at replacelist() which will probably do a better job here than rename.

Re: URLdecode limit expansion.

Posted: 07 Dec 2010 17:46
by SkyFrontier
LOL
admin wrote:

Code: Select all

rename s, ... ... ... <madness> ...
Hmm, it seems there is a cleverer way to do this.... also look at replacelist() which will probably do a better job here than rename.
Too late... "I made it the hardest walk, part 2". :D
-and yes, I'll try the cleverer way, of course... By the time, here goes the dumbest way:

Code: Select all

   $str = "<clipboard>";

   $str = replace($str,"%20"," ");
   $str = replace($str,"%21","!");
   $str = replace($str,"%22",""");
   $str = replace($str,"%23","#");
   $str = replace($str,"%24","$");
   $str = replace($str,"%25","%");
   $str = replace($str,"%26","&");
   $str = replace($str,"%27","'");
   $str = replace($str,"%28","(");
   $str = replace($str,"%29",")");
   $str = replace($str,"%2A","*");
   $str = replace($str,"%2B","+");
   $str = replace($str,"%2C",",");
   $str = replace($str,"%2D","-");
   $str = replace($str,"%2E",".");
   $str = replace($str,"%2F","/");
   $str = replace($str,"%30","0");
   $str = replace($str,"%31","1");
   $str = replace($str,"%32","2");
   $str = replace($str,"%33","3");
   $str = replace($str,"%34","4");
   $str = replace($str,"%35","5");
   $str = replace($str,"%36","6");
   $str = replace($str,"%37","7");
   $str = replace($str,"%38","8");
   $str = replace($str,"%39","9");
   $str = replace($str,"%3A",":");
   $str = replace($str,"%3B",";");
   $str = replace($str,"%3C","<");
   $str = replace($str,"%3D","=");
   $str = replace($str,"%3E",">");
   $str = replace($str,"%3F","?");
   $str = replace($str,"%40","@");
   $str = replace($str,"%41","A");
   $str = replace($str,"%42","B");
   $str = replace($str,"%43","C");
   $str = replace($str,"%44","D");
   $str = replace($str,"%45","E");
   $str = replace($str,"%46","F");
   $str = replace($str,"%47","G");
   $str = replace($str,"%48","H");
   $str = replace($str,"%49","I");
   $str = replace($str,"%4A","J");
   $str = replace($str,"%4B","K");
   $str = replace($str,"%4C","L");
   $str = replace($str,"%4D","M");
   $str = replace($str,"%4E","N");
   $str = replace($str,"%4F","O");
   $str = replace($str,"%50","P");
   $str = replace($str,"%51","Q");
   $str = replace($str,"%52","R");
   $str = replace($str,"%53","S");
   $str = replace($str,"%54","T");
   $str = replace($str,"%55","U");
   $str = replace($str,"%56","V");
   $str = replace($str,"%57","W");
   $str = replace($str,"%58","X");
   $str = replace($str,"%59","Y");
   $str = replace($str,"%5A","Z");
   $str = replace($str,"%5B","[");
   $str = replace($str,"%5C","\");
   $str = replace($str,"%5D","]");
   $str = replace($str,"%5E","^");
   $str = replace($str,"%5F","_");
   $str = replace($str,"%60","`");
   $str = replace($str,"%61","a");
   $str = replace($str,"%62","b");
   $str = replace($str,"%63","c");
   $str = replace($str,"%64","d");
   $str = replace($str,"%65","e");
   $str = replace($str,"%66","f");
   $str = replace($str,"%67","g");
   $str = replace($str,"%68","h");
   $str = replace($str,"%69","i");
   $str = replace($str,"%6A","j");
   $str = replace($str,"%6B","k");
   $str = replace($str,"%6C","l");
   $str = replace($str,"%6D","m");
   $str = replace($str,"%6E","n");
   $str = replace($str,"%6F","o");
   $str = replace($str,"%70","p");
   $str = replace($str,"%71","q");
   $str = replace($str,"%72","r");
   $str = replace($str,"%73","s");
   $str = replace($str,"%74","t");
   $str = replace($str,"%75","u");
   $str = replace($str,"%76","v");
   $str = replace($str,"%77","w");
   $str = replace($str,"%78","x");
   $str = replace($str,"%79","y");
   $str = replace($str,"%7A","z");
   $str = replace($str,"%7B","{");
   $str = replace($str,"%7C","|");
   $str = replace($str,"%7D","}");
   $str = replace($str,"%7E","~");
   $str = replace($str,"%7F","&nbsp;");
   $str = replace($str,"%80","€");
   $str = replace($str,"%81","&nbsp;");
   $str = replace($str,"%82","‚");
   $str = replace($str,"%83","ƒ");
   $str = replace($str,"%84","„");
   $str = replace($str,"%85","…");
   $str = replace($str,"%86","†");
   $str = replace($str,"%87","‡");
   $str = replace($str,"%88","ˆ");
   $str = replace($str,"%89","‰");
   $str = replace($str,"%8A","Š");
   $str = replace($str,"%8B","‹");
   $str = replace($str,"%8C","Œ");
   $str = replace($str,"%8D","&nbsp;");
   $str = replace($str,"%8E","Ž");
   $str = replace($str,"%8F","&nbsp;");
   $str = replace($str,"%90","&nbsp;");
   $str = replace($str,"%91","‘");
   $str = replace($str,"%92","’");
   $str = replace($str,"%93","“");
   $str = replace($str,"%94","”");
   $str = replace($str,"%95","•");
   $str = replace($str,"%96","–");
   $str = replace($str,"%97","—");
   $str = replace($str,"%98","˜");
   $str = replace($str,"%99","™");
   $str = replace($str,"%9A","š");
   $str = replace($str,"%9B","›");
   $str = replace($str,"%9C","œ");
   $str = replace($str,"%9D","&nbsp;");
   $str = replace($str,"%9E","ž");
   $str = replace($str,"%9F","Ÿ");
   $str = replace($str,"%A0","&nbsp;");
   $str = replace($str,"%A1","¡");
   $str = replace($str,"%A2","¢");
   $str = replace($str,"%A3","£");
   $str = replace($str,"%A4","&nbsp;");
   $str = replace($str,"%A5","¥");
   $str = replace($str,"%A6","|");
   $str = replace($str,"%A7","§");
   $str = replace($str,"%A8","¨");
   $str = replace($str,"%A9","©");
   $str = replace($str,"%AA","ª");
   $str = replace($str,"%AB","«");
   $str = replace($str,"%AC","¬");
   $str = replace($str,"%AD","¯");
   $str = replace($str,"%AE","®");
   $str = replace($str,"%AF","¯");
   $str = replace($str,"%B0","°");
   $str = replace($str,"%B1","±");
   $str = replace($str,"%B2","²");
   $str = replace($str,"%B3","³");
   $str = replace($str,"%B4","´");
   $str = replace($str,"%B5","µ");
   $str = replace($str,"%B6","¶");
   $str = replace($str,"%B7","·");
   $str = replace($str,"%B8","¸");
   $str = replace($str,"%B9","¹");
   $str = replace($str,"%BA","º");
   $str = replace($str,"%BB","»");
   $str = replace($str,"%BC","¼");
   $str = replace($str,"%BD","½");
   $str = replace($str,"%BE","¾");
   $str = replace($str,"%BF","¿");
   $str = replace($str,"%C0","À");
   $str = replace($str,"%C1","Á");
   $str = replace($str,"%C2","Â");
   $str = replace($str,"%C3","Ã");
   $str = replace($str,"%C4","Ä");
   $str = replace($str,"%C5","Å");
   $str = replace($str,"%C6","Æ");
   $str = replace($str,"%C7","Ç");
   $str = replace($str,"%C8","È");
   $str = replace($str,"%C9","É");
   $str = replace($str,"%CA","Ê");
   $str = replace($str,"%CB","Ë");
   $str = replace($str,"%CC","Ì");
   $str = replace($str,"%CD","Í");
   $str = replace($str,"%CE","Î");
   $str = replace($str,"%CF","Ï");
   $str = replace($str,"%D0","Ð");
   $str = replace($str,"%D1","Ñ");
   $str = replace($str,"%D2","Ò");
   $str = replace($str,"%D3","Ó");
   $str = replace($str,"%D4","Ô");
   $str = replace($str,"%D5","Õ");
   $str = replace($str,"%D6","Ö");
   $str = replace($str,"%D7","&nbsp;");
   $str = replace($str,"%D8","Ø");
   $str = replace($str,"%D9","Ù");
   $str = replace($str,"%DA","Ú");
   $str = replace($str,"%DB","Û");
   $str = replace($str,"%DC","Ü");
   $str = replace($str,"%DD","Ý");
   $str = replace($str,"%DE","Þ");
   $str = replace($str,"%DF","ß");
   $str = replace($str,"%E0","à");
   $str = replace($str,"%E1","á");
   $str = replace($str,"%E2","â");
   $str = replace($str,"%E3","ã");
   $str = replace($str,"%E4","ä");
   $str = replace($str,"%E5","å");
   $str = replace($str,"%E6","æ");
   $str = replace($str,"%E7","ç");
   $str = replace($str,"%E8","è");
   $str = replace($str,"%E9","é");
   $str = replace($str,"%EA","ê");
   $str = replace($str,"%EB","ë");
   $str = replace($str,"%EC","ì");
   $str = replace($str,"%ED","í");
   $str = replace($str,"%EE","î");
   $str = replace($str,"%EF","ï");
   $str = replace($str,"%F0","ð");
   $str = replace($str,"%F1","ñ");
   $str = replace($str,"%F2","ò");
   $str = replace($str,"%F3","ó");
   $str = replace($str,"%F4","ô");
   $str = replace($str,"%F5","õ");
   $str = replace($str,"%F6","ö");
   $str = replace($str,"%F7","÷");
   $str = replace($str,"%F8","ø");
   $str = replace($str,"%F9","ù");
   $str = replace($str,"%FA","ú");
   $str = replace($str,"%FB","û");
   $str = replace($str,"%FC","ü");
   $str = replace($str,"%FD","ý");
   $str = replace($str,"%FE","þ");
   $str = replace($str,"%FF","ÿ");

   copytext $str;
   status "URLdecoding done! Don't hate me! ^^";

Re: URLdecode limit expansion.

Posted: 07 Dec 2010 17:53
by admin
You won't earn much respect for this approach. It's the definition of dumbness. :P

Re: URLdecode limit expansion.

Posted: 07 Dec 2010 18:20
by SkyFrontier
...not earning respect because of a dumb solution for an otherwise unsolvable problem, OS-limit side?
...is it really better than having no solution at all?
Hmmmmm... I'd really prefer to see the problem solved the fastest way possible than not having any answer. My modest 2 cents - and again, thanks for the tips! (thanks to the previous, now I have a better version-checking code, under tests - when I find the time I'll edit posted scripts containing the old code)
---
*DISCLAIMER*
This is the table I used to build the list:
http://www.w3schools.com/TAGS/ref_urlencode.asp
-by seeing the results, I'm thinking that either that table or the hosting site in which I'm working with contains ambiguities.
ling ¡stica - should read linguística
episàdios - should read episódios
I'm considering a full revision, but having not enough sample inputs covering any possible situations to work with makes it a long term operation.
-If you know a reliable table I can work with, please let me know. It seems that such lack of standards should not occur, but... real life bites hard.

Re: URLdecode limit expansion.

Posted: 07 Dec 2010 20:00
by SkyFrontier
Funny... by the looks of it, seems to be the same old madness on new clothes! :D
-this one fixes the (due to syntax) incompatible "comma", plus other HTML related remaining coding. (Brazilian) portuguese users may need to wait until I manage to tweak the dictionary a bit, based off daily usage so we can get a reliable stuff to work with. Not enough references on web, so I'll have to look for offline refs. too.

Code: Select all

   $a = replacelist("<clipboard>", "%20,%21,%22,%23,%24,%25,%26,%27,%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Ž, , ,‘,’,“,”,•,–,—,˜,™,š,›,œ, ,ž,Ÿ, ,¡,¢,£, ,¥,|,§,¨,©,ª,«,¬,¯,®,¯,°,±,²,³,´,µ,¶,·,¸,¹,º,»,¼,½,¾,¿,À,Á,Â,Ã,Ä,Å,Æ,Ç,È,É,Ê,Ë,Ì,Í,Î,Ï,Ð,Ñ,Ò,Ó,Ô,Õ,Ö, ,Ø,Ù,Ú,Û,Ü,Ý,Þ,ß,à,á,â,ã,ä,å,æ,ç,è,é,ê,ë,ì,í,î,ï,ð,ñ,ò,ó,ô,õ,ö,÷,ø,ù,ú,û,ü,ý,þ,ÿ", ",", 1);
   $a = replace($a,"comma", ",");
   copytext $a;
   status "All done!";

Re: URLdecode limit expansion.

Posted: 08 Dec 2010 05:54
by SkyFrontier
admin wrote:Not possible. The UrlUnescape Function is limited to INTERNET_MAX_URL_LENGTH (2083):

const int INTERNET_MAX_PATH_LENGTH = 2048;
const int INTERNET_MAX_SCHEME_LENGTH = 32;
const int INTERNET_MAX_URL_LENGTH = INTERNET_MAX_SCHEME_LENGTH + 3 + INTERNET_MAX_PATH_LENGTH;
...Help file/documentation could mention such a limit, what about...?