Hi
i'm converting utf-8 string to iso-8859-5 string and save it in database.( if there is even one invalid char, futher processing aborted and user reported that some field contain invalid chars.)
iconv() generates E_NOTICE error when it sees invalid character so i can trap it with custom error handler.
then i looked into mb_convert_encoding() function.
the problem with it that it does not let you know if there are any invalid chars in the string.
the only workaround that i thought about is to use mb_substitute_character() to set substitute char to some special char and after call to mb_convert_encoding() , search the converted string for that char.. but this solution looks somewhat clumsy...
can anyone offer another way?
thanks.
iconv vs. mbstring - invalid character detection
Moderator: General Moderators