![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhsBDk3HUTEvZIZfCF0u-RYdwO_79_pZGEzjuV6H62PYnsV1ONSu4uurnbHO7GX5-JdW7VekELrDTo0j34RfSpZeVf-FwKl_G8mbAqaPyEolq10GS3vMPek4jC2r4gkaELGV-aJ2C-Gu4/s200/error.png)
The problem occurs when the HTML page file contains characters encoded with a different format of that which the browser is using to read, displaying them incorrectly. For example, the HTML page is encoded with "Windows-1262" format, but the browser is reading as "UTF-8", then you will see things like this:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjabBkwBUNMlQIK9Fyxkd7dX7BVeuhbw5VnNox7JnJ5oqcG29vrSBd0-4p8BG-UUCha-uqmfODw94lat_857FMlvO5_S4HHLnWuOcbunQg_wfLbGH1thvWOHSaWCc-30FYGMKwv2o0eDpk/s320/3.png)
The solution is simple, the HTML file and browser encode format must match, for example, both using UTF-8. But how can this be done? in the HTML header tag insert the 'charset' meta tag, that tells to the browser what is its encoded format:
<meta charset="UTF-8" />
And in the editor used to save the HTML file, set the encode format to UTF-8 too. For example, in the Eclipse IDE:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRjGguvCLaZBvxdDKvmNrqDPLa4ZGN1_zZ79ap7djtFdVW1yu56ycWOSSITr3rDYQ9_yBT35qunbkEgHIISAaW_9Te700zZXGydxd-XpEEWevHsHG83MGdGD6IaTNkxRWzGDfxBVCi5-k/s640/2.png)
Notepad++ editor:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXT6LRMhc3L6LfifQViA72pXlR5NRnY-PSLYxn8ZM9TBglJ5ZhD2Dfz6qj03iF0zAJsSYygg0bV54i2RVIag9urf-bgO1OMZP8ib0wgxacyf7n0hChZsqKprjU2qPRQjjGFMD238GNUZo/s1600/4.png)
Now with both, HTML file and browser using the same encode format you can see the characters correctly:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixTiHFOcqBLzy6OOmFxasZJl0N1B4rn0fH_OHA8Sk9k5Xf5LQvO7xED1wI4aNh_B0_cJmpydRlwrwS-k0_ljigrevbn58kbB-9bg-Cs5yojYip_Hk_Iz-ey3WudPn9Ese7-hOON5EHoX0/s320/4.png)
About the versions
- Eclipse Java EE IDE Luna (4.4.1)
- Notepad++ 6.5.5
0 comentários :
Post a Comment