{$CLEO} wait 0 while not SAMP.Available() wait 400 end alloc 0@ 256 format 0@ = "testпривет 0123456789~!()" call @urlEncode 1 str 0@ to 1@ chat "%s -> %s" -1 0@ 1@ chat "Pointer: %p" -1 1@ free 0@ 1@ = 0 ect :urlEncode // call @urlEncode 1 str 0@ 0C3A: 1@ = string "" pointer alloc 5@ 6 // buf memset 5@ 0 6 strlen 2@ 0@ 2@-- // for cycle for 3@ = 0 to 2@ step 1 0C1D: 4@ = array 0@ element 3@ el_size 1 if 4@ <> 0x0 jf break 0C2C: 6@ = strrchr 1@ char 0x0 if gosub @url_encode_cond then 0C15: strcat destination 1@ source 4@v else 0C15: strcat destination 1@ source "%" 0C1C: 5@ = itoa 4@ radix 16 0C15: strcat destination 1@ source 5@v end end free 5@ ret 1 1@ :url_encode_cond if and 4@ >= 0x30 // 0 4@ <= 0x39 // 9 then ret_true else if and 4@ >= 0x41 // a 4@ <= 0x5A // z then ret_true else if and 4@ >= 0x61 // A 4@ <= 0x7A // Z then ret_true else if or 4@ == 0x21 // ! 4@ == 0x28 // ( 4@ == 0x29 // ) 4@ == 0x5C // \ 4@ == 0x7E // ~ then ret_true else ret_false end end end end return /* // Source: https://github.com/azuremous/ofxTwitcurl/blob/master/libs/libtwitcurl/.svn/text-base/urlencode.cpp.svn-base #include "urlencode.h" std::string char2hex( char dec ) { char dig1 = (dec&0xF0)>>4; char dig2 = (dec&0x0F); if ( 0<= dig1 && dig1<= 9) dig1+=48; //0,48 in ascii if (10<= dig1 && dig1<=15) dig1+=65-10; //A,65 in ascii if ( 0<= dig2 && dig2<= 9) dig2+=48; if (10<= dig2 && dig2<=15) dig2+=65-10; std::string r; r.append( &dig1, 1); r.append( &dig2, 1); return r; } std::string urlencode( const std::string &c ) { std::string escaped; int max = c.length(); for(int i=0; i