Skip to main content



      Home
Home » Language IDEs » ServerTools (WTP) » JavaScript files with UTF-8 encoding
JavaScript files with UTF-8 encoding [message #205778] Thu, 13 December 2007 15:17 Go to next message
Eclipse UserFriend
Originally posted by: scott.gonzalez.gmail.com

I have Eclipse setup to use UTF-8 for text files (in the General ->
Workspace settings). However, it views all .js files as ISO-8859-1.

If I create a new text file, then check the properties from the Navigation
tab (right click on the file in Navigation and choose "Properties" from
the menu), in the "Text file encoding" frame it says "Default (inherited
from container: UTF-8)", which is what I would expect. However, if I then
change the extension of the file to .js and repeat the steps, the encoding
now say "Default (determined from content: ISO-8859-1)".

I can manually change it to UTF-8. When I try to apply this setting, I
get a warning that says, "UTF-8 conflicts with the encoding defined in the
content type (ISO-8859-1). Do you wish to set it anyways?" If I click
yes, it will properly treat the file as UTF-8.

Does anyone why Eclipse considers all .js files to be encoded as
ISO-8859-1?

I'm using Eclipse 3.2.2 on Windows XP.
Re: JavaScript files with UTF-8 encoding [message #205803 is a reply to message #205778] Fri, 14 December 2007 00:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

You need to go to Preferences->Editor->Content-Type->Text->Javascript
and change the content type for *.js from ISO-8859-1 to UTF-8.

Dave


> I can manually change it to UTF-8. When I try to apply this setting, I
> get a warning that says, "UTF-8 conflicts with the encoding defined in
> the content type (ISO-8859-1). Do you wish to set it anyways?" If I
> click yes, it will properly treat the file as UTF-8.
>
> Does anyone why Eclipse considers all .js files to be encoded as
> ISO-8859-1?
>
Re: JavaScript files with UTF-8 encoding [message #205850 is a reply to message #205803] Fri, 14 December 2007 09:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: scott.gonzalez.gmail.com

Thanks, that works.


David Carver wrote:

> You need to go to Preferences->Editor->Content-Type->Text->Javascript
> and change the content type for *.js from ISO-8859-1 to UTF-8.
Re: JavaScript files with UTF-8 encoding [message #205866 is a reply to message #205803] Fri, 14 December 2007 12:05 Go to previous messageGo to next message
Eclipse UserFriend
David Carver schrieb:
> You need to go to Preferences->Editor->Content-Type->Text->Javascript
> and change the content type for *.js from ISO-8859-1 to UTF-8.

In addition to that.

- Having specified a charset with a Context-Type forces this
charset on all an every File.
- Leaving the charset blank, makes the editor to adhere to
project-/container-settings

--
Chris
Re: JavaScript files with UTF-8 encoding [message #1454577 is a reply to message #205866] Tue, 28 October 2014 10:47 Go to previous message
Eclipse UserFriend
I need the eclipse does not force the encoding and use the defined project.
In earlier versions the "default encoding" field was empty, but the newest version is utf-8 and not have to leave blank. I had to create a configuration file with the parameters blank to get resolved. Sad

it seems a bug

in:
.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.core.runtime.prefs
content:
content-types/org.eclipse.wst.jsdt.core.jsSource/charset=
content-types/org.eclipse.wst.jsdt.core.jsonSource/charset=
Previous Topic:Why is HttpServlet needed on the Java Build Path?
Next Topic:DOM object
Goto Forum:
  


Current Time: Tue Jul 22 19:08:23 EDT 2025

Powered by FUDForum. Page generated in 0.24340 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top