Contrary to the docs, _trim() doesn't normalize internal whitespace:
_trim(" x x ") == ("x x") != ("x x")
The current behavior is quite conventional, so one approach is to call
the discrepency a "documentation bug" and strike this line:
"Also trims internal repeated whitespace down to a single
instance."
http://www.google.com/apis/homepage/reference.html#JS_Ref
Here's a code workaround:
// Strips whitespace from ends and normalizes internal whitespace
function trim__MODULE_ID__(str) {return _trim(str).replace(/\s+/g,
" ");}