Since I started working with Apache, PHP/HTML/CSS/JS and databases such as MySQL, I always had to deal with latin charset problems.
I mean, starting from the database until the views are displayed in the browser screen, through all the many instances in which charset can be altered, I never had the chance of working with no problems, except with a Wamp/Xampp installation in localhost with Windows.
I always tried to set all charsets/encoding/collation in every place I could, but I always had different results, depending on the server (Linux, Windows).
I always check:
1) Database collation.
2) Table collation.
3) Column collation.
4) Apache charset configuration in httpd.conf
5) PHP charset configuration in php.ini
6) Individual php/html file encoding.
7) Addition of meta tag in every html with same encoding/charset.
8) Addition of "header(... charset...)" with same encoding/charset;
But in many circumstances, I keep on receiving unrecognized chars instead of accents and special latin symbols. Sometimes it works ok in the screen, but I find problems with generated CSV/Excels, or as a JSON response from a webservice, etc.
I checked other posts like this one: PHP Character encoding problems
I try to follow the tips, but I can't fix the problem in certain cases.
Tired of trying lots of things I always end up using functions such as utf8_encode / decode, or iconv(...). Sometimes I even get the desired result only by using both utf8_encode/decode, one inside the other. Horrible.
Is there a tidy and easy way to resolve this without having to use those scary functions that leave the code untidy? Is the Operating System an issue? I tend to see more charset problems while running systems in Linux servers.