2

I got a problem with my character encoding. Whenever I load a page in the browser, It shows like this: enter image description here

So I need to manually configure it by the browser. Thanks for your help.

NullPoiиteя
  • 56,591
  • 22
  • 125
  • 143
Tepken Vannkorn
  • 9,648
  • 14
  • 61
  • 86

2 Answers2

13

sounds like you don't serve your content as utf-8. do this by setting the correct header:

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

in addition to be really sure the browser understands, add a meta-tag:

<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

note that, depending on where the text comes from, you might have to check some other things too (database-connection, source-file-encoding, ...) - i've listed a lot of them in one of my answers to a similar question.

Community
  • 1
  • 1
oezi
  • 51,017
  • 10
  • 98
  • 115
2

As stated by kraikkonen85 in this comment:

Besides setting mysql_set_charset and adding utf8 setting metadata to html, another important but "unpredictable" reason is the encoding type of your PHP editor when saving. For example, if you save the php file other than encodings such as "unicode" or "ANSI", as i experienced, you may notice weird chars like squares, question marks etc.

To make sure, try "save as" method to see explictly that your php file is being saved as utf8.

it may be because your content might not utf-8 you can set utf-s by setting the header and meta

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


<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
Brad Larson
  • 170,088
  • 45
  • 397
  • 571
NullPoiиteя
  • 56,591
  • 22
  • 125
  • 143