HighDots Forums  

escape o encodeURI ?

Javascript (Italian) Il linguaggio JavaScript (it.comp.lang.javascript)


Discuss escape o encodeURI ? in the Javascript (Italian) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default escape o encodeURI ? - 10-15-2009 , 07:22 AM






Salve,
devo postare via ajax stringa contenente vocali accentate e simboli "&"
ecc.

var param = 'Prova è';
var paramsToSend = escape(param); // vale "Prova%20%E8%22%2C%22"

se posto questa stringa firebug non evidenzia alcun post, con conseguente
valore null lato server (php)
quindi in qualche modo il contenuto di questa stringa impedisce il suo
post.
Ho risolto il problema usando:
var paramsToSend = encodeURI(param); // vale "Prova%20%C3%A8%22,%22"
e questo funziona !
ma se la stringa contiene il carattere &
var param = 'Prova &';
var paramsToSend = encodeURI(param); // vale "Prova%20&%22,%22"
e il post di questa variabile causa un valore errato del post (visto da
firebug)

Cosa devo usare per inviare simboli accentati e caratteri speciali ?
Grazie

--


questo articolo e` stato inviato via web dal servizio gratuito
http://www.newsland.it/news segnala gli abusi ad abuse (AT) newsland (DOT) it

Reply With Quote
  #2  
Old   
Alessandro Pellizzari
 
Posts: n/a

Default Re: escape o encodeURI ? - 10-15-2009 , 07:54 AM






Il Thu, 15 Oct 2009 13:22:50 +0200, dinosauro ha scritto:

Quote:
devo postare via ajax stringa contenente vocali accentate e simboli "&"
endoceURIComponent()

Bye.

Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: escape o encodeURI ? FUNZIONA ! - 10-15-2009 , 07:59 AM



Alessandro Pellizzari ha scritto:

Quote:
Il Thu, 15 Oct 2009 13:22:50 +0200, dinosauro ha scritto:

devo postare via ajax stringa contenente vocali accentate e simboli "&"

endoceURIComponent()

Bye.
Grazie !

--


questo articolo e` stato inviato via web dal servizio gratuito
http://www.newsland.it/news segnala gli abusi ad abuse (AT) newsland (DOT) it

Reply With Quote
  #4  
Old   
Cristiano Larghi
 
Posts: n/a

Default Re: escape o encodeURI ? FUNZIONA ! - 10-16-2009 , 05:43 AM



Il Thu, 15 Oct 2009 13:59:30 +0200, dinosauro ha scritto:

Quote:
endoceURIComponent()
ti segnalo che è stata introdotta in IE 5.5, se vuoi supporto per browser
più vecchi (es. IE 5.0), qua ho trovato questa soluzione (non testata):
http://www.worldtimzone.com/res/encode/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.