Hi,

I have a lot of files i need to read with PHP script. All of them has the ANSI encoding type and, unfortunately, they contain special characters. Since my page is in UTF8, i need to convert the file content to UTF8 on the fly while reading them. What's the best method to convert the content to display all the special foreign characters normally?

Thanks

Will the correct syntax be iconv("ANSI", "UTF-8", $text) or iconv("Windows-1252", "UTF-8", $text) or neither?

The second one: iconv("Windows-1252", "UTF-8", $text)

also test with:

iconv("Windows-1252", "UTF-8//TRANSLIT", $text);
iconv("Windows-1252", "UTF-8//IGNORE", $text);
iconv("Windows-1252", "UTF-8//TRANSLIT//IGNORE", $text);

If characters arn't converting correctly

Member Avatar for diafol

I don't understand why your extended chars won't display under UTF-8. Can you give an example of some text and your <head> section?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.