URL Encode problem

Just starting out? Need help? Post your questions and find answers here.
anelehto
New User
New User
Posts: 5
Joined: Sat Jun 23, 2012 10:45 pm

URL Encode problem

Post by anelehto »

Hi,

I have noticed that firefox in order to http post some characters from the greek alphabet (ISO-8859-7) encodes the string.
I try to do the same but when i use URLEncoder() or similar functions found in this forum the returned string is different..

For example the word "τεστ" (test in greek) is encoded by firefox as %CF%84%CE%B5%CF%83%CF%84 and by URLEncoder as %F4%E5%F3%F4. If i post the string from firefox all is ok.


How i can do the same without replacing every single character with his code?
anelehto
New User
New User
Posts: 5
Joined: Sat Jun 23, 2012 10:45 pm

Re: URL Encode problem

Post by anelehto »

Code: Select all

Procedure.s Encode(str.s)
in.s="ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΥΩαβγδεζηθικλμνξοπρστυφχψωάέήίόύώ"
out.s="%CE%91%CE%92%CE%93%CE%94%CE%95%CE%96%CE%97%CE%98%CE%99%CE%9A%CE%9B%CE%9C%CE%9D%CE%9E%CE%9F%CE%A0%CE%A1%CE%A3%CE%A4%CE%A5%CE%A6%CE%A7%CE%A5%CE%A9%CE%B1%CE%B2%CE%B3%CE%B4%CE%B5%CE%B6%CE%B7%CE%B8%CE%B9%CE%BA%CE%BB%CE%BC%CE%BD%CE%BE%CE%BF%CF%80%CF%81%CF%83%CF%84%CF%85%CF%86%CF%87%CF%88%CF%89%CE%AC%CE%AD%CE%AE%CE%AF%CF%8C%CF%8D%CF%8E"

 For z = 1 To Len(in)
  str=ReplaceString(str,Mid(in,z,1),Mid(out,z*6-5,6))
 Next z
 
ProcedureReturn str
EndProcedure
This works :D
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: URL Encode problem

Post by luis »

Uhm.... you are right. Probably the PB UrlEncoder() does not encode using UTF-8 ?
So it can url-encode ascii only ?
Or maybe I'm missing something, I'm not sure.
"Have you tried turning it off and on again ?"
Post Reply