mirror of
https://github.com/php/php-src.git
synced 2026-10-28 17:56:50 +08:00
determine_charset() ran strlen() and walked the charset map with case-insensitive compares on every call, while "UTF-8" (explicit or from default_charset) is what nearly every call asks for. It now checks for "utf-8" in any case first, and moves the walk to a separate function. The codesets of the charset map are now lowercase. The walk lowercases the hint once, then compares the length and the first byte before calling memcmp(), so other charsets resolve faster too. The "utf-8" entry of the charset map is removed, since the walk can no longer reach it.