[jQuery] UTF-8 problems

[jQuery] UTF-8 problems

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Tahoma">If you don't have your page
programmed in UTF-8 (like i do) and still want to process data sent by
jQuery, you can use this PHP snippet.
    /**
     * Returns true if the call came from jQuery or prototype.
     * @return        boolean
     */
    function isAjax() {
        return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'));
    }
    /**
     * Searches the $strKey in the $_POST or $_GET array en gives the
value of it back.
     * An empty string is returned if $strKey can't be found.
     * @param        string
     * @return        string
     */
    function getvar($strKey) {
        $strValue = '';
        if (isset($_POST[$strKey])) {
            $strValue = $_POST[$strKey];
        } else if (isset($_GET[$strKey])) {
            $strValue = $_GET[$strKey];
        }
        return (!isAjax()) ? $strValue : utf8_decode($strValue);
    }
usage:
    $foo = getvar('bar');
docs:
    Gets the "bar" value which was sent or an empty string if there was
nothing.
p.s. I see no reason for going to UTF-8 when not working with
multilangual sites, am i wrong?
-- Gilles
</font></font>
</body>
</html>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/