valid_unicode

The timeline below displays how wordpress function valid_unicode has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.4

/**
 * Determines if a Unicode codepoint is valid.
 *
 * @since 2.7.0
 *
 * @param int $i Unicode codepoint.
 * @return bool Whether or not the codepoint is a valid Unicode codepoint.
 */
function valid_unicode($i)
{
    $i = (int) $i;
    return 0x9 === $i || 0xa === $i || 0xd === $i || 0x20 <= $i && $i <= 0xd7ff || 0xe000 <= $i && $i <= 0xfffd || 0x10000 <= $i && $i <= 0x10ffff;
}

WordPress Version: 5.4

/**
 * Determines if a Unicode codepoint is valid.
 *
 * @since 2.7.0
 *
 * @param int $i Unicode codepoint.
 * @return bool Whether or not the codepoint is a valid Unicode codepoint.
 */
function valid_unicode($i)
{
    return 0x9 == $i || 0xa == $i || 0xd == $i || 0x20 <= $i && $i <= 0xd7ff || 0xe000 <= $i && $i <= 0xfffd || 0x10000 <= $i && $i <= 0x10ffff;
}

WordPress Version: 5.1

/**
 * Determines if a Unicode codepoint is valid.
 *
 * @since 2.7.0
 *
 * @param int $i Unicode codepoint.
 * @return bool Whether or not the codepoint is a valid Unicode codepoint.
 */
function valid_unicode($i)
{
    return $i == 0x9 || $i == 0xa || $i == 0xd || $i >= 0x20 && $i <= 0xd7ff || $i >= 0xe000 && $i <= 0xfffd || $i >= 0x10000 && $i <= 0x10ffff;
}

WordPress Version: 4.8

/**
 * Helper function to determine if a Unicode value is valid.
 *
 * @since 2.7.0
 *
 * @param int $i Unicode value
 * @return bool True if the value was a valid Unicode number
 */
function valid_unicode($i)
{
    return $i == 0x9 || $i == 0xa || $i == 0xd || $i >= 0x20 && $i <= 0xd7ff || $i >= 0xe000 && $i <= 0xfffd || $i >= 0x10000 && $i <= 0x10ffff;
}

WordPress Version: 3.7

/**
 * Helper function to determine if a Unicode value is valid.
 *
 * @param int $i Unicode value
 * @return bool True if the value was a valid Unicode number
 */
function valid_unicode($i)
{
    return $i == 0x9 || $i == 0xa || $i == 0xd || $i >= 0x20 && $i <= 0xd7ff || $i >= 0xe000 && $i <= 0xfffd || $i >= 0x10000 && $i <= 0x10ffff;
}