Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php setting encoding iso-8859-1 by default in browser

Tags:

php

encoding

I have a php file which when displays data shows strange characters, but when I change encoding from tools in chrome to iso-8859-1 the strange characters are displayed correctly, the strange characters are actually Portuguese alphabets. please tell how can we set by default the encoding to iso-8859-1.

like image 583
Nishant Avatar asked Dec 28 '22 11:12

Nishant


1 Answers

header('Content-Type: text/html; charset=iso-8859-1');

You should ideally use utf-8. If it doesn't work automatically, that means it's improperly encoded on the database and you should convert it to utf-8.

like image 63
meder omuraliev Avatar answered Jan 12 '23 00:01

meder omuraliev