The common problem with fresh projects in php is that, when developing with Windows you sometimes might start programming with notepad. Well the problem arises when saving your work, because the default notepad saves your work in ANSI format. Looking the work in browser you only see strange characters and äüõü will not be displayed. To solve the problem is to save it as UTF-8 and make sure it changes the encoding.
You might see strange characters also by fetching and displaying data from database. To avoid that set the database “DEFAULT CHARACTER SET utf8” or by setting the value individually for each table. Well I did this, but the problem remains. Also set the MySQLi’s extension charset $mysqli->set_charset(“utf8”).
How does the browser know which encoding to use ? Basically browser parses the DOM tree and looks for meta tag on top with the correct charset like this
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">.