I was creating a PHP-level search function using stripos to check if the search query was found in a string. Everything was working perfectly except special characters were still case sensitive.
Turns out the problem is that the default locale was set to one not supporting those characters. To fix it, change the default locale to a better match or set the locale manually using the setlocale function:
setlocale(LC_ALL, 'is_IS');