PHP Classes

urlencode

Recommend this page to a friend!

      Google Geocode API  >  All threads  >  urlencode  >  (Un) Subscribe thread alerts  
Subject:urlencode
Summary:method url_encode() needs to use multibyte str_split()
Messages:6
Author:Peter Kahl
Date:2011-09-21 04:53:10
Update:2011-10-11 14:29:59
 

  1. urlencode   Reply   Report abuse  
Picture of Peter Kahl Peter Kahl - 2011-09-21 04:53:10
Works great, except for Chinese addresses (using Chinese characters).

After examining the code, I see that you are processing a multibyte string with str_split(), which is not mulitbyte safe.

My fix was replacing the method url_encode() with PHP native function urlencode.

  2. Re: urlencode   Reply   Report abuse  
Picture of Wouter Snels Wouter Snels - 2011-10-01 14:26:36 - In reply to message 1 from Peter Kahl
where can i review your fix cause i can't seem to find it anywhere ..

Regards, ..

  3. Re: urlencode   Reply   Report abuse  
Picture of Wouter Snels Wouter Snels - 2011-10-01 14:51:56 - In reply to message 1 from Peter Kahl
the default urlencode from php didn't encode it to the proper format, .. google only understands utf8 encoding. url_encode does more then just encode the url. keep that in mind.

  4. Re: urlencode   Reply   Report abuse  
Picture of Wouter Snels Wouter Snels - 2011-10-01 15:16:47 - In reply to message 1 from Peter Kahl
Thank you for reporting i hope it is fixed now, Regards, ..

  5. Re: urlencode   Reply   Report abuse  
Picture of Peter Kahl Peter Kahl - 2011-10-01 22:20:06 - In reply to message 4 from Wouter Snels
I see your fix with the mb_strsplit(). It very likely works. However, my own fix is to use urlencode() only and it works really well in my system, even on encoding Chinese characters (gets proper response from Google). So your mb_strsplit() is not necessary.

  6. Re: urlencode   Reply   Report abuse  
Picture of Wouter Snels Wouter Snels - 2011-10-11 14:29:59 - In reply to message 5 from Peter Kahl
you're right weird thing is, it didn't work before for me either now today it does work, strange, .. i wonder if i did any special updates that could of caused it.