Eclipse converts ascii to utf-8 without warning [message #1269929] |
Wed, 12 March 2014 06:21  |
Eclipse User |
|
|
|
Hi All,
My Eclipse workspace is set to UTF-8 as is my OS (Linux). When I open a file that is asccii encoded and contains extended ascii characters that are invalid utf-8, Eclipse gives no warning. When I save the file, Eclipse saves as utf-8 and replaces all invalid utf-8 character with the (valid) utf-8 character U+FFFD (displayed as �, hex EF BF BD).
I'd agree that the source file should not be asccii in the first place, still I'd like Eclipse to give a warning when opening a file that is invalid utf-8. Is there a setting in Eclipse to make it behave that way?
I am using Eclipe Kepler version 4.3.1 with PDT extension version 3.2.0
TIA, Mark.
|
|
|
Re: Eclipse converts ascii to utf-8 without warning [message #1270598 is a reply to message #1269929] |
Thu, 13 March 2014 03:41   |
Eclipse User |
|
|
|
You need to set "ISO-8859-1" to the file->Properties->Resource->Text file encoding.
BTW,
Since it is a matter of Eclipse Platform, not PDT, I recommend to re-post the issue on more responsible forum Eclipse Community Forums: Newcomers or Eclipse Community Forums: Eclipse Platform.
Eclipse Platform doesn't care if a file contains invalid utf-8 characters, and they are converted into the replacement character(U+FFFD) automatically, as you know.
This behaviour can be controled by CharsetDecoder and CodingErrorAction. I'm not sure but current implementation of Eclipse Platform seems to be not having such way. (I'm seeing org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.setDocumentContent(IDocument, IFile, String))
So, it's better to request the function you want against Eclipse Platform team, IMO.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03475 seconds