seco Posted February 12, 2008 Share Posted February 12, 2008 Hi i have encoded string using javascript and i want to decode it before saving it to db the string looks like %u0645%u062E%u062A%u0627%u0631%20 and i want any phph function that can decode the above line probably thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/ Share on other sites More sharing options...
haku Posted February 12, 2008 Share Posted February 12, 2008 try urldecode(%u0645%u062E%u062A%u0627%u0631%20); Never tried it with strings encoded by javascript, but it should be ok. Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465030 Share on other sites More sharing options...
kenrbnsn Posted February 12, 2008 Share Posted February 12, 2008 Doesn't work. I tried that and using rawurldecode(). Ken Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465038 Share on other sites More sharing options...
kenrbnsn Posted February 12, 2008 Share Posted February 12, 2008 What was the javascript function used to encode the string? Ken Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465041 Share on other sites More sharing options...
seco Posted February 12, 2008 Author Share Posted February 12, 2008 i don;t know what function used i just get the data and i ahave to work with it but this site work well with me in decoding http://meyerweb.com/eric/tools/dencoder/ rawurldecode don't do thing with me i try to decode an array like this foreach($_POST as $k => $v) { array_push($params, getValue("POST", $k)); } $params = array_values($params); rawurldecode($params); is there is something wrong ? Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465103 Share on other sites More sharing options...
revraz Posted February 12, 2008 Share Posted February 12, 2008 Well here you say you have encoded a string, post how you did that. Hi i have encoded string using javascript and i want to decode it before saving it to db the string looks like %u0645%u062E%u062A%u0627%u0631%20 Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465115 Share on other sites More sharing options...
seco Posted February 12, 2008 Author Share Posted February 12, 2008 i mean some one encode it and i have to decode it like the site i mention above so how t odecode the array in the above code? Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465131 Share on other sites More sharing options...
revraz Posted February 12, 2008 Share Posted February 12, 2008 Did you read the text at the bottom? If you'd like to have the URL Decoder/Encoder for offline use, just view source and save to your hard drive. Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465139 Share on other sites More sharing options...
Illusion Posted February 12, 2008 Share Posted February 12, 2008 try using urldecoder(); and it expect string as a argument not an array ,like what you did rawurldecode($params); Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465149 Share on other sites More sharing options...
seco Posted February 12, 2008 Author Share Posted February 12, 2008 the site use unescape(encoded.replace(/\+/g, " ")); and i want to input my php string into it how? Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465153 Share on other sites More sharing options...
seco Posted February 12, 2008 Author Share Posted February 12, 2008 also urldecode do nothing seems that i shold send phph variable to this js code unescape(encoded.replace(/\+/g, " ")); code to decode it Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465171 Share on other sites More sharing options...
seco Posted February 12, 2008 Author Share Posted February 12, 2008 any idea how to send php variable $myvar to js code to decode and retrieve it back to php? Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465180 Share on other sites More sharing options...
nikefido Posted February 12, 2008 Share Posted February 12, 2008 PECL or PEAR might have a encoder for this...i know they can deal with JSON encoding. Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465248 Share on other sites More sharing options...
seco Posted February 12, 2008 Author Share Posted February 12, 2008 is this %u0645%u062E%u062A%u0627%u0631%20 a json encoding? Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465255 Share on other sites More sharing options...
kenrbnsn Posted February 12, 2008 Share Posted February 12, 2008 No, it is not a json encoding. It looks like an encoding of a UNICODE string. Ken Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465257 Share on other sites More sharing options...
seco Posted February 12, 2008 Author Share Posted February 12, 2008 ok i want to run this unescape(encoded.replace(/\+/g, " ")); on it because when this function process it it returns what i need how to decode it? Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465265 Share on other sites More sharing options...
seco Posted February 13, 2008 Author Share Posted February 13, 2008 i want any server side function that can decode it because i try urldecode and rawurldecode and do nothing i want a function to do like the above js function thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465675 Share on other sites More sharing options...
kenrbnsn Posted February 13, 2008 Share Posted February 13, 2008 I've been looking, but so far nothing I've tried has worked... Ken Quote Link to comment https://forums.phpfreaks.com/topic/90720-how-to-decode-strings-that-was-encoded-using-js/#findComment-465802 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.