Google Search API and correct encoding

19 July 2007 15:40 (EST)
Those using CFMX CFC wrapper for Google Search API should be aware of following encoding issue:

If you have
<cfprocessingdirective pageencoding="utf-8" />
tag on your page to support non-English content (cyrillic, chinese, etc.), then call to Google Search API with non-English query would not return anything.

While looking deep into origin of this issue I have discovered that apparently cfinvoke causes the problem. If you will send a SOAP request using cfhttp tag to Google Search API then all results are returned correctly.

But you have to force iso-8859-1 encoding to query string before sending it through CFC and cfinvoke.

<cfset q = CharsetEncode(CharsetDecode(q, "utf-8"), "iso-8859-1") />

Oddly enough?
Tags cfc cfmx api trick utf8 google soap search encoding cfinvoke cfhttp

AddThis Social Bookmark Button

Broken content type String encoding conversion

Comments

Drop a comment... don't be shy


Similar entries