Friday, February 27, 2009

Displaying Google Search Params

If I search for 'lensbase víüçñ' in using internet explorer, and capture the 'q' parameter from $_SERVER["HTTP_REFERER"] in PHP, I get 'lensbase+v%C3%AD%C3%BC%C3%A7%C3%B1'. There may be an easy way to convert all the %xx back to something readable, but I did not find it (tried urldecode,  utf8_decode, iconv, and about 100 other things).

I found a urlRawDecode function that worked great on windows, but not on Linux.

I found JavaScript code here, but calling it was just another problem.

At the end, I store my data as the full gobblygook, and then "fix it" on the display. For display, I set my header to utf-8 using 
header('Content-type: text/html; charset=utf-8');
and call urldecode on the string. That fixes everything except the + symbol and, since it's just a quick and dirty check of queries from google, I just str_replace them with spaces.

Tuesday, February 10, 2009


If you need a simply color picker utility, I'm very happy with ColorCop.