View Single Post
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 01-10-2021 , 09:37   Re: Want for urldecode method, need help with rewrite from C
Reply With Quote #2

I've something like this.. that all which can I do ))

Code:
stock void decodeURL(const char[] inStr, char[] outStr, int size) {         char buffer[4096]; int len = strlen(inStr); int wpos = 0; int diff = 0;         // "%D0%BF%D1%80%D0%BE%D1%81%D1%82%D0%BE+%D0%BF%D0%B0%D1%80%D0%B0%D0%BB%D0%BB%D0%B5%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9+%D0%BC%D0%B8%D1%80" = len         for(int i = 0; i < len; i += diff)     {         special[4]; strcopy(special, sizeof(special), inStr[i]);         chars[6]; strcopy(chars, sizeof(chars), inStr[i]);             for(int j = 0; j < sizeof(dec); ++j)         {             if(StrEqual(special, dec[j][1], false))             {                 strcopy(outStr, size, inStr[wpos]); ++wpos; diff = 4;             }                         else if(StrEqual(chars, dec[j][1], false))             {                 strcopy(outStr, size, inStr[wpos]); ++wpos;  diff = 6;             }         }     }         PrintToServer("Decoded URL: %s", outStr); }

And some characters table..
Code:
static char dec[][] = {     {"~", "%7E"},     {"`", "60%"},     {"'", "27%"},         /* ....... */     {"Ю", "%D0%A%"},     {"ю", "%D1%8%"},     {"Я", "%D0%A%"},     {"я", "%D1%8F"} };

Last edited by DarkDeviL; 01-23-2021 at 22:15. Reason: Restore to previous version.
ZASTRELIS is offline