Batch convert latin-1 files to utf-8 using iconv

You shouldn’t use ls like that and a for loop is not appropriate either. Also, the destination directory should be outside the source directory. mkdir /path/to/destination find . -type f -exec iconv -f iso-8859-1 -t utf-8 “{}” -o /path/to/destination/”{}” \; No need for a loop. The -type f option includes files and excludes directories. Edit: … Read more

iconv – Detected an illegal character in input string

If you used the accepted answer, however, you will still receive the PHP Notice if a character in your input string cannot be transliterated: <?php $cp1252 = ”; for ($i = 128; $i < 256; $i++) { $cp1252 .= chr($i); } echo iconv(“cp1252”, “utf-8//TRANSLIT”, $cp1252); PHP Notice: iconv(): Detected an illegal character in input string … Read more

How do I remove accents from characters in a PHP string?

What about the WordPress implementation? function remove_accents($string) { if ( !preg_match(‘/[\x80-\xff]/’, $string) ) return $string; $chars = array( // Decompositions for Latin-1 Supplement chr(195).chr(128) => ‘A’, chr(195).chr(129) => ‘A’, chr(195).chr(130) => ‘A’, chr(195).chr(131) => ‘A’, chr(195).chr(132) => ‘A’, chr(195).chr(133) => ‘A’, chr(195).chr(135) => ‘C’, chr(195).chr(136) => ‘E’, chr(195).chr(137) => ‘E’, chr(195).chr(138) => ‘E’, chr(195).chr(139) => … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)