Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change file encoding

I have a problem with character encoding in some HTML pages. It seems that the cause of the problem is that some of the .html files are not saved as UTF-8 encoded files. Even though I have instructed Eclipse to save these files as UTF-8, when I open them in a browser, it indicates that the files are ISO-8859-1.

How can I change the encoding of these files to UTF-8?

UPDATE: I already have the following included in the section of each webpage

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

I am using the Apache web server.

Thanks, Donal

like image 826
Dónal Avatar asked Feb 12 '09 18:02

Dónal


1 Answers

You may need to change the content type header that your web server sends the client.

Edit: While this did work for this particular situation, using a tool to change the file encoding as suggested by other posters may be a better solution in other situations. YMMV.


Instructions for saving as UTF-8 in Eclipse (which I realize you already have):

You should probably change the Default Encoding in your workspace for the HTML document.

This is for Eclipse 3.4. If you have a different version, this may be slightly different.

Goto Window->Preferences
In the Preferences window goto General->Content Types
At this point, you can specify a 'Default Encoding' for files near the bottom of the preferences window. Expand 'Text' and select HTML. In the 'Default Encoding' entry, put UTF-8. Then click 'update' at the right.

After this, all HTML files should be saved in UTF-8 format.

like image 101
Akrikos Avatar answered Sep 24 '22 22:09

Akrikos