Hi, Please don't cross-post. You've already posted this to the appropriate group:
http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/2d721cacad30d9e7 In fact, you've already gotten a response over there (and had done before posting here). Thanks, -- T.J. Crowder tj / crowder software / com On Oct 21, 9:57 am, Uzm <[EMAIL PROTECTED]> wrote: > Hey, i recently came across a problem with Prototype encoding > function. Maybe it's not a fault of Prototype... Well, we'll see. > I have following code: > > function getData() { > new Ajax.Request('chat.php', { method: 'post', encoding: > 'windows-1251', parameters: "userId=" + userId + "&msgtime=" + > msgtime, > onComplete: function(getDataRequest) { > if (getDataRequest.responseText.substr(0,1) == "|") { > clearTimeout(yo); > alert(getDataRequest.responseText.substr(1,getDataRequest.responseText.length > - 1)); > exit();} > > else { > var lines = getDataRequest.responseText.split('\n'); > lines.length = lines.length - 1; > if (lines.length > 0) { > onlineUserList = lines[0].split("|"); > onlineUserList.length = onlineUserList.length - 1;} > > if (lines.length > 1) { > for (i = 1; i < lines.length; i++) { > var msg = lines[i].split("|"); > try { > parent.talk.printmsg(msg[0],msg[1],msg[2],msg[3]);} catch (e) { > } > msgtime = msg[4]; > } > } > > seichas = document.getElementById("chatlan"); > mysp = document.createElement("span"); > hrprfr = document.createTextNode("ЮЗЕРОВ ОНЛАЙН: " + > onlineUserList.length); > mysp.appendChild(hrprfr); > seichas.replaceChild(hrprfr, seichas.firstChild); > parent.menu.printmenu();} > > yo = setTimeout('getData()', chatTimeout);}, > > onFailure: function(transport) { > alert('XHR failed!\nReason:' + transport.responseText) > > } } ); > } > > The problem aligns in "&msgtime=" + msgtime. Msgtime is received from > MySQL database first. Msgtime type in the database is "TIME", so it > displays current time in H:m:s (hours:minutes:seconds). > > I've debugged the request with SoftX HTTP debugger, and somehow > "msgtime" is shown as "21%A305%A345", although it should be > "21:05:45". Is it an encoding issue? Of it is, how do i solve it? I've > tried with encodeURIcomponent(), but it doesn't seem to work. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---
