Skip to main content



      Home
Home » Language IDEs » PHP Development Tools (PDT) » How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)?
How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #95825] Sat, 28 March 2009 05:58 Go to next message
Eclipse UserFriend
Originally posted by: warren.tang.nospaml.com

Hi everybody,

I've been trying to set the default encoding of new files as UTF-8. Here
are the two settings I've set:

1. Windows > Preferences > General > Content Types, set UTF-8 as the
default encoding for all content types.
2. Windows > Preferences > General > Workspaces, set "Text file
encoding" to "Other : UTF-8".

However when I create a new text file, the encoding is always
ANSI/ISO-8859-1. What did I missed? Thanks.

Regards,
Warren
Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #95885 is a reply to message #95825] Sat, 28 March 2009 23:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: warren.tang.nospam.com

Warren Tang wrote:
> Hi everybody,
>
> I've been trying to set the default encoding of new files as UTF-8. Here
> are the two settings I've set:
>
> 1. Windows > Preferences > General > Content Types, set UTF-8 as the
> default encoding for all content types.
> 2. Windows > Preferences > General > Workspaces, set "Text file
> encoding" to "Other : UTF-8".
>
> However when I create a new text file, the encoding is always
> ANSI/ISO-8859-1. What did I missed? Thanks.
>
> Regards,
> Warren

I've also tried
Project Properties > Resource > Text file encoding = UTF-8
However it doesn't work either.

The only thing that works is changing the file's encoding property, but
I don't want to change it every time I create a new file.

Is it a bug?
Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #95928 is a reply to message #95885] Mon, 30 March 2009 07:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: warren.tang.nospam.com

Warren Tang wrote:
> Warren Tang wrote:
>> Hi everybody,
>>
>> I've been trying to set the default encoding of new files as UTF-8.
>> Here are the two settings I've set:
>>
>> 1. Windows > Preferences > General > Content Types, set UTF-8 as the
>> default encoding for all content types.
>> 2. Windows > Preferences > General > Workspaces, set "Text file
>> encoding" to "Other : UTF-8".
>>
>> However when I create a new text file, the encoding is always
>> ANSI/ISO-8859-1. What did I missed? Thanks.
>>
>> Regards,
>> Warren
>
> I've also tried
> Project Properties > Resource > Text file encoding = UTF-8
> However it doesn't work either.
>
> The only thing that works is changing the file's encoding property, but
> I don't want to change it every time I create a new file.
>
> Is it a bug?

It turns out that there are other places I need to set up for HTML and
CSS files:

Windows > Preferences > Web > CSS Files > Encoding = UTF-8
Windows > Preferences > Web > HTML Files > Encoding = UTF-8
Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #95940 is a reply to message #95928] Mon, 30 March 2009 07:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: warren.tang.nospam.com

Warren Tang wrote:
> Warren Tang wrote:
>> Warren Tang wrote:
>>> Hi everybody,
>>>
>>> I've been trying to set the default encoding of new files as UTF-8.
>>> Here are the two settings I've set:
>>>
>>> 1. Windows > Preferences > General > Content Types, set UTF-8 as the
>>> default encoding for all content types.
>>> 2. Windows > Preferences > General > Workspaces, set "Text file
>>> encoding" to "Other : UTF-8".
>>>
>>> However when I create a new text file, the encoding is always
>>> ANSI/ISO-8859-1. What did I missed? Thanks.
>>>
>>> Regards,
>>> Warren
>>
>> I've also tried
>> Project Properties > Resource > Text file encoding = UTF-8
>> However it doesn't work either.
>>
>> The only thing that works is changing the file's encoding property,
>> but I don't want to change it every time I create a new file.
>>
>> Is it a bug?
>
> It turns out that there are other places I need to set up for HTML and
> CSS files:
>
> Windows > Preferences > Web > CSS Files > Encoding = UTF-8
> Windows > Preferences > Web > HTML Files > Encoding = UTF-8

I'm getting mad... The file (on the disk) is still not encoded in UTF-8
but ANSI.
Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #497037 is a reply to message #95825] Thu, 12 November 2009 05:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

As I have struggled with this kind of issue, here is my suggestion:

maybe use
-Dfile.encoding=UTF-8
in the VM arguments.
This will force java to save file in UTF-8 even when the OS uses another encoding.
Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #535513 is a reply to message #95825] Mon, 24 May 2010 04:31 Go to previous messageGo to next message
Eclipse UserFriend
I have the same problem. All new jsp files I create get ISO-8859-1 as default encoding. Even when I set UTF-8 manually, sometimes it changes back to ISO-8859-1, saying "determined from content: ISO-8859-1", even though the file contains non ASCII characters.

I need a reliable way to say that all jsp files that I create should be utf-8 encoded. Is there a way to achieve this?
Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #537579 is a reply to message #95825] Wed, 02 June 2010 21:08 Go to previous messageGo to next message
Eclipse UserFriend
I don't know if this is applicable in you case but,
I usually create a project, and creating PHP files under that project. Once I set the project's charset to UTF-8, all new files created under that project will inherit the encoding.
Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #543783 is a reply to message #537579] Wed, 30 June 2010 10:45 Go to previous messageGo to next message
Eclipse UserFriend
2 years after encoding problems still alive.

Now I got my projects to be in utf-8 by default. Great.

But I also have old projects in iso-8859-1. I can switch them to that encoding for a session (right click on project > properties > etc...). But each time I relaunch Eclipse and re-open that project again it is switched back to utf-8 without any notice. So if I save a file it is corupted with iso8859-1 read as utf-8 without knowing it.
Several days after I see some "�" in place of "é" in my project's outputs. Embarrassed

Is there a way to fix that ?

Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #543800 is a reply to message #543783] Wed, 30 June 2010 11:27 Go to previous messageGo to next message
Eclipse UserFriend
You can set the default encoding for your workspace by going to Window >
Preferences > General > Workspace.

The "�" might be a byte order mark
(http://en.wikipedia.org/wiki/Byte_order_mark). I had a similar problem
where those characters were shown, which turned out to be that. PHP
doesn't properly handle BOM's.

One way to remove it is by using Notepad++ (free advanced notepad editor
you can get from http://notepad-plus-plus.org/), and use the "Encoding >
Convert to UTF-8 without BOM" feature to save your file without the byte
order mark (BOM).

Regards,

Marijn.

On 30-06-10 16:45, frms@webologix.com wrote:
> 2 years after encoding problems still alive.
>
> Now I got my projects to be in utf-8 by default. Great.
> But I also have old projects in iso-8859-1. I can switch them to that
> encoding for a session (right click on project > properties > etc...).
> But each time I relaunch Eclipse and re-open that project again it is
> switched back to utf-8 without any notice. So if I save a file it is
> corupted with iso8859-1 read as utf-8 without knowing it.
> Several days after I see some "�" in place of "é" in my project's
> outputs. :blush:
> Is there a way to fix that ?
>
>
Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #1061773 is a reply to message #95825] Mon, 03 June 2013 17:34 Go to previous messageGo to next message
Eclipse UserFriend
This is SUPER frustrating. Any file that does not have an extension (which is usually a text file is writing out with those damned ^M at the end Sad. I have the default set to Unix UTF-8 at every place mentioned in this thread and eclipse still insists on saddling me with these delimiters in my unix installed Juno (Ubuntu 12.04). Flippin' unbelievable Sad


Can't somebody fix this after so many years open on these forums?
Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #1061908 is a reply to message #1061773] Tue, 04 June 2013 12:01 Go to previous messageGo to next message
Eclipse UserFriend
Try this:



1. backup the project and delete it
2. close Eclipse
3. convert all the project text files using an encoding converter, like enca
4. open eclipse
5. create a new project and be sure the default project encoding is utf-8
6. import all the project file in the new project

[Updated on: Wed, 05 June 2013 04:03] by Moderator

Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #1068126 is a reply to message #1061908] Fri, 12 July 2013 05:58 Go to previous messageGo to next message
Eclipse UserFriend
If you want to set the default encoding of all Eclipse files to UTF-8, you can append to eclipse.ini the vm option

-Dfile.encoding=UTF8

Then check all the preferences and you'll see that every default will be set to UTF-8.
For me it works at least.
icon10.gif  Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #1701160 is a reply to message #95825] Thu, 09 July 2015 11:06 Go to previous messageGo to next message
Eclipse UserFriend
Or, try this:

Windows > Preferences > General > Workspace > Text file encoding

check Other , select UTF-8
Re: How to Set UTF-8 as the Default Encoding for New Text Files in PDT 2.0 (Eclipse 3.4)? [message #1701161 is a reply to message #1068126] Thu, 09 July 2015 11:08 Go to previous message
Eclipse UserFriend
Or, try this:

Windows > Preferences > General > Workspace > Text file encoding

check Other, select UTF-8
Previous Topic:Informative: Debugger hangs, breaks server (XDebug, PDT 3.5?)
Next Topic:XAMPP installation in Eclipse
Goto Forum:
  


Current Time: Tue May 06 04:04:39 EDT 2025

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

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

Back to the top