encoding - Combine different headers in PHP for non-English text -


i using php display foreign languages text.

  echo '<li> no english </li>'; 

to display non english language written in php use:

header('content-type: text/html; charset=windows-1255'); 

but when getting posted variables form , try echo them, display trash. noticed setting next header, fix :

header('content-type: text/html; charset=utf-8'); 

this header display correctly, fails display first example.

how can combine different header settings in same file.?

you cannot mix encodings in single document. entire document must in 1 coherent encoding 1 header set denotes encoding. if receive differently encoded strings several sources, convert them 1 uniform encoding (preferably utf-8) using mb_convert_encoding or iconv.

if '<li> no english </li>' hardcoded text saved in source code file, save file in different encoding in text editor. see utf-8 way through , handling unicode front in web app.


Comments

Popular posts from this blog

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -