protected static function _pos(
        $haystack, $needle, $offset, $charset, $func
    )
    {
        if (Horde_Util::extensionExists('mbstring')) {
            unset($php_errormsg);
            $track_errors = ini_set('track_errors', 1);
            $ret = @call_user_func('mb_' . $func, $haystack, $needle, $offset, self::_mbstringCharset($charset));
            ini_set('track_errors', $track_errors);
            if (!isset($php_errormsg)) {
                return $ret;
            }
        }

        if (Horde_Util::extensionExists('intl')) {
            unset($php_errormsg);
            $track_errors = ini_set('track_errors', 1);
            $ret = self::convertCharset(
                @call_user_func(
                    'grapheme_' . $func,
                    self::convertCharset($haystack, $charset, 'UTF-8'),
                    self::convertCharset($needle, $charset, 'UTF-8'),
                    $offset
                ),
                'UTF-8',
                $charset
            );
            ini_set('track_errors', $track_errors);
            if (!isset($php_errormsg)) {
                return $ret;
            }
        }

        return $func($haystack, $needle, $offset);
    }