diff -r -u linden-orig/indra/llcommon/lluri.cpp linden/indra/llcommon/lluri.cpp --- linden-orig/indra/llcommon/lluri.cpp 2007-12-12 16:14:30.000000000 +0900 +++ linden/indra/llcommon/lluri.cpp 2007-12-19 11:55:22.875000000 +0900 @@ -57,7 +57,7 @@ { ostr << "%" << std::uppercase << std::hex << std::setw(2) << std::setfill('0') - << static_cast(c); + << (static_cast(c) & 0xFF); } else { @@ -68,6 +68,23 @@ } // static +std::string LLURI::urlencode(const std::string& str) +{ + if (str.empty()) + { + return str; + } + + // Our own special set of allowed chars (RFC1738 http://www.ietf.org/rfc/rfc1738.txt ) + const char* allowed = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789" + "-._~$+!*'()"; + + return escape(str, allowed); +} + +// static std::string LLURI::unescape(const std::string& str) { std::ostringstream ostr; diff -r -u linden-orig/indra/llcommon/lluri.h linden/indra/llcommon/lluri.h --- linden-orig/indra/llcommon/lluri.h 2007-12-12 16:14:30.000000000 +0900 +++ linden/indra/llcommon/lluri.h 2007-12-19 10:08:48.031250000 +0900 @@ -131,6 +131,7 @@ static std::string escape( const std::string& str, const std::string & allowed); + static std::string urlencode(const std::string& str); static std::string unescape(const std::string& str); //@} diff -r -u linden-orig/indra/newview/llpaneldirfind.cpp linden/indra/newview/llpaneldirfind.cpp --- linden-orig/indra/newview/llpaneldirfind.cpp 2007-12-12 16:14:34.000000000 +0900 +++ linden/indra/newview/llpaneldirfind.cpp 2007-12-19 12:03:20.046875000 +0900 @@ -179,38 +179,10 @@ { if (!search_text.empty()) { - // Replace spaces with "+" for use by Google search appliance - // Yes, this actually works for double-spaces - // " foo bar" becomes "+foo++bar" and works fine. JC - - // Since we are already iterating over the query, - // do our own custom escaping here. - - // Our own special set of allowed chars (RFC1738 http://www.ietf.org/rfc/rfc1738.txt) - const char* allowed = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - "0123456789" - "-._~$+!*'()"; - std::string query; - std::string::const_iterator it = search_text.begin(); - for ( ; it != search_text.end(); ++it ) - { - if ( std::isspace( *it ) ) - { - query += '+'; - } - else if(strchr(allowed,*it)) - { - // The character is in the allowed set, just copy it - query += *it; - } - else - { - // Do escaping - query += llformat("%%%02X", *it); - } - } + + // Do URLencoding + query = LLURI::urlencode(search_text); std::string url = gSavedSettings.getString("SearchURLQuery"); std::string substring = "[QUERY]";