[jQuery] Re: JQuery Form Plugin: encodeURIcomponent/decodeURI with ISO-8859-1
Thanks SeViR for your help, but in this case I must use ASP, nor ASP.NET. Regards, 2007/5/15, SeViR <[EMAIL PROTECTED]>: > > > Have you check to decode in server side? > > /Encoding iso = Encoding.GetEncoding("iso8859-1"); > //Encoding unicode = Encoding.UTF8; > > I have never any problem with that. > / > > > > sithram escribió: > > Thanks Tony and Mike for your help, but I continue with the same > > problem after your indications. > > > > If I don't use ajax to send data (I mean I use normal submit) the ASP > > page of the server works fine and insert information with the correct > > characters. > > > > Regards, > > > > Xavier > > > > On 12 mayo, 15:39, "Mike Alsup" <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > -- > Best Regards, > José Francisco Rives Lirola > > SeViR CW · Computer Design > http://www.sevir.org > > Murcia - Spain > > > > > >
[jQuery] Re: JQuery Form Plugin: encodeURIcomponent/decodeURI with ISO-8859-1
Have you check to decode in server side? /Encoding iso = Encoding.GetEncoding("iso8859-1"); //Encoding unicode = Encoding.UTF8; I have never any problem with that. / sithram escribió: Thanks Tony and Mike for your help, but I continue with the same problem after your indications. If I don't use ajax to send data (I mean I use normal submit) the ASP page of the server works fine and insert information with the correct characters. Regards, Xavier On 12 mayo, 15:39, "Mike Alsup" <[EMAIL PROTECTED]> wrote: -- Best Regards, José Francisco Rives Lirola SeViR CW · Computer Design http://www.sevir.org Murcia - Spain
[jQuery] Re: JQuery Form Plugin: encodeURIcomponent/decodeURI with ISO-8859-1
Thanks Tony and Mike for your help, but I continue with the same problem after your indications. If I don't use ajax to send data (I mean I use normal submit) the ASP page of the server works fine and insert information with the correct characters. Regards, Xavier On 12 mayo, 15:39, "Mike Alsup" <[EMAIL PROTECTED]> wrote: > You just need to decode the UTF on the server. JavaScript uses UTF-8 > for encoding. You don't want to send the unencoded data, that defeats > the whole point of encoding. > > Mike > > > function showFORM(formData, jqForm, options) { > > var queryString = $.param(formData); > > qs=queryString.split('&'); > > for (var x=0;x > i=qs[x].split('='); > > if (i[0]=='cmt') { > > alert('cmt (decode):\n\n'+decodeURI(i[1])); > > alert('\n\ncmt:\n\n'+i[1]); > > } > > } > > return true; > > } > > > In the message box I think that the decode information is that I need > > to send, not the encode one.
[jQuery] Re: JQuery Form Plugin: encodeURIcomponent/decodeURI with ISO-8859-1
You just need to decode the UTF on the server. JavaScript uses UTF-8 for encoding. You don't want to send the unencoded data, that defeats the whole point of encoding. Mike function showFORM(formData, jqForm, options) { var queryString = $.param(formData); qs=queryString.split('&'); for (var x=0;x
[jQuery] Re: JQuery Form Plugin: encodeURIcomponent/decodeURI with ISO-8859-1
Maybe you shuld use a option 'contentType' in the $.ajax function, or simple use $.ajaxSetup to setup ISO-8859-1 charset. See documenttation of jQuery how to do that. Regards Tony
[jQuery] Re: JQuery Form Plugin: encodeURIcomponent/decodeURI with ISO-8859-1
More information: In the ASP page I have a URLdecode function to use it before insert the data: function URLDecode(psEncodeString) { return unescape(psEncodeString); } I test with this one too: Private Function URLDecode_vbs(byVal encodedstring) Dim strIn, strOut, intPos, strLeft Dim strRight, intLoop strIn = encodedstring strOut = "" intPos = Instr(strIn, "+") Do While intPos strLeft = "" strRight = "" If intPos > 1 then strLeft = Left(strIn, intPos - 1) If intPos < len(strIn) then strRight = Mid(strIn, intPos + 1) strIn = strLeft & " " & strRight intPos = InStr(strIn, "+") intLoop = intLoop + 1 Loop intPos = InStr(strIn, "%") Do while intPos If intPos > 1 then strOut = strOut & Left(strIn, intPos - 1) strOut = strOut & Chr(CInt("&H" & mid(strIn, intPos + 1, 2))) If intPos > (len(strIn) - 3) then strIn = "" Else strIn = Mid(strIn, intPos + 3) End If intPos = InStr(strIn, "%") Loop URLDecode = strOut & strIn End Function Thanks! Xavier On 12 mayo, 07:48, sithram <[EMAIL PROTECTED]> wrote: > Hello! > > I need to can use ISO-8859-1 in send data to server with the > (selector).ajaxForm(options). I see that uses encodeURIcomponent in > serialize parameters, and this does that the sending information uses > strange codes. > > initial text > recieved text > després > després > informació > informació > > If have this code: > > var opt = { > target: '#avis', > beforeSubmit: showFORM, > success: saveFORM > }; > > $('#frm').ajaxForm(opt); > > function showFORM(formData, jqForm, options) { > var queryString = $.param(formData); > qs=queryString.split('&'); > for (var x=0;x i=qs[x].split('='); > if (i[0]=='cmt') { > alert('cmt (decode):\n\n'+decodeURI(i[1])); > alert('\n\ncmt:\n\n'+i[1]); > } > } > return true; > } > > In the message box I think that the decode information is that I need > to send, not the encode one. > > This information is managed with an ASP page that insert it in a > database. This ASP have <%Response.Charset="ISO-8859-1"%>, but it > doesn't seem work (I think that is a normal behavior because the ASP > page has to recieve data, it doesn't send data to client). > > If you need more information, you don't hesitate to ask me for it. > > Thanks a lot! > > Xavier