utf 8 - PHP Find if any character of a string is not in ISO 8859-1 -



utf 8 - PHP Find if any character of a string is not in ISO 8859-1 -

i'm facing problem checking encodes. know encodes mess , hard check.

i went lot of options , ended trying preg_match.

i need observe if character not valid ascii or iso 8859-1 (latin1 in mysql).

i ended this:

return 0 === preg_match('/[^\x00-\x7f\xa2-\xff]+/', $value);

but not work table:

¢£¤¥¦§¨©ª«¬-®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ

some of characters not valid latin, in latin charset. É or À guess because locale or internal function of encondigs set utf8.

because ʧ evaluates valid latin character. when not in charset http://es.wikipedia.org/wiki/iso_8859-1

any help here much appreciated.

note:

i made lot of tests mb_detect_encoding, mb_check_encoding, mb_convert_encoding , iconv of them homecoming ʧ valid latin1 character.

i'm bit lost here.

php utf-8 character-encoding latin1

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -