Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

URLDecode vs decodeURIComponent

Guest
Mar 22, 2007 Mar 22, 2007
Hi All,

I am working on windows 2000 server, cfmx 6.1

I have to encod an url parameter, i do that with the javascript function "encodeURIComponent()" because sometimes the sign "+" is in the string.
That works fine.
The problem is with latin characters non ascii:
myString = "Acteur / Métier";
url = "mysite?maVar="+encodeURIComponent(myString);

Server Side:
I have tried
<cfset theVar = url.maVar>
<cfset theVar = URLDecode(url.maVar)>
...
but each time the result is the same theVar = "Acteur / Métier"

Does any one know how to solv this?
2.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 22, 2007 Mar 22, 2007
You could convert your string to base64. that should allow you to retain your special characters in a URL safe manner.

toBase64(MyString)

Then you could convert back on the other side. I'm a little fuzzy on the functions, but I think it s a combination of ToBinary() and ToString()
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 23, 2007 Mar 23, 2007
LATEST
Thanks a lot.

Like i have to encode with javascript, i have found a function to do that http://ostermiller.org/calc/encode.html and Server Side i use
<cfset maVar = ToBinary(url.maVar)>
and
<cfset maVar = ToString(variables.maVar)>
and all is OK.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources