0

I am working whit a great deal of rare Characters inside Javascript characters like 'èéêëēėẹěəæεɛ', and im storing them inside a array but for some reason javascript can't recognize them and puts alot of question marks where it cant recognize them i have:

<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

included on the page but when ever i just Alert (èéêëēėẹěəæεɛ'); i get results like "����eeeeee�???" and even when i copy paste the characters in the array they end up like this 'èéêëeee?e?æe?' some of them are missing.

Could anyone tell me what i am missing so i can store these characters so that they remain in the array like 'èéêëēėẹěəæεɛ' this and they get displayed also out like that.

Csak Zoli
  • 408
  • 1
  • 4
  • 11

1 Answers1

2

web browsers determine the character encoding of a webpage via:

  • if loaded from the filesytem, use the <meta charset
  • if loaded from a url:
    • if an http header exists that specifies the charset, use it. done.
    • else look for a <meta charset

most web servers send an http header that specifies the encoding/characterset. You need to configure it to send the correct one, which is utf-8(assuming your text editor really is configured to save the file as utf-8). The important take away of the decidion process is that a web browser generally ignores your meta tag because your webserver sends a real http header, and the real http headers takes precedence.

goat
  • 31,486
  • 7
  • 73
  • 96
  • Ok here is what i have done it seems that it is working aperently now.. I made Encoding->Encode in UTF-8 without BOM and i copy pasted the 'èéêëēėẹěəæεɛ' again and now its displaying it like how i want it but did this resolve for all browsers? – Csak Zoli Dec 30 '12 at 18:03
  • yes you did, as long as your web server sends either no charset http header at all, or it sends the correct utf8 one. otherwise, your results will be unreliable. – goat Dec 30 '12 at 18:04
  • I checked in Chrome and IE 6 to and works fine :D il go look if it works on my brothers PC and if it does then i will accept your answer brb – Csak Zoli Dec 30 '12 at 18:06