public static function makeJsonEncodable($objValue)
    {
        if (QCUBED_ENCODING == 'UTF-8') {
            return $objValue; // Nothing to do, since all strings are already UTF-8 and objects can take care of themselves.
        }

        switch (gettype($objValue)) {
            case 'string':
                $objValue = mb_convert_encoding($objValue, 'UTF-8', QCUBED_ENCODING);
                return $objValue;

            case 'array':
                $newArray = array();
                foreach ($objValue as $key => $val) {
                    $key = self::makeJsonEncodable($key);
                    $val = self::makeJsonEncodable($val);
                    $newArray[$key] = $val;
                }
                return $newArray;

            default:
                return $objValue;

        }
    }