| Eclipse character encoding problem [message #779691] |
Mon, 16 January 2012 05:34  |
Missing name Missing name Messages: 7 Registered: December 2011 |
Junior Member |
|
|
Hi,
Sorry if this have been discussed before, I could not find a solution to my particular problem.
I am using Eclipse Indigo V. 3.7.0
When I save a particualr file,the following error comes:
"Save could not be Completed
Reason:
Some characters cannot be mapped using "ISO-8859-1" character encoding.
Either change the encoding or remove the characters which are not supported by the "ISO-8859-1" character encoding
"
It tells me to save in UTF-8. If I save the file in UTF-8, then I have following problem when I see the changes in Clear-Case version control:
über became �ber
für became f�r
fr became f�r
The file is may be 10-15 years old, and may be was originally done in "ISO-8859-1", May be in the mean time some of the encoding are corrupted (like "fr", which should be "für"). The thing is, those are only in the comments, and I do not need to change them, but Eclipse changes them "Automatically". If I save the files with Code-Warrior or Notepad++. they are not changed automatically.
I have tried to save the file with US-ANSI, cp1252, UTF-8 also, with same result.
What I can change in EClipse so that it leaves those un-changed ? Or finds the correct encoding for, say "ü" ?
Thank you.
|
|
|
|
| Re: Eclipse character encoding problem [message #779756 is a reply to message #779750] |
Mon, 16 January 2012 08:43   |
Missing name Missing name Messages: 7 Registered: December 2011 |
Junior Member |
|
|
Its the default "Inherited from container (ISO-8859-1)"
I guess it takes the default from the
Window -> Preferences -> Workspace -> Text file encoding.
I have also tested the Text file encoding with all others (US-ANSI, cp1252, UTF-8, UTF-16), with same results.
Is there a way to tell Eclipse that it should only save the DELTA in a changed file, and not the whole document?
|
|
|
| Re: Eclipse character encoding problem [message #779787 is a reply to message #779756] |
Mon, 16 January 2012 10:05   |
Axel Mueller Messages: 1829 Registered: July 2009 |
Senior Member |
|
|
Your file is seems not to be encoded in ISO-8859-1. So when Eclipse loads the file with ISO-8859-1 encoding and then encounters a character that does not belong to this encoding it will fail. What can you do?
1) Open the file but do not edit it
2) In the main menu select Edit->Set Encoding... (this will change the encoding for the current file in the editor)
3) Choose e.g UTF-8
4) Are your umlauts still OK? If yes then try to edit the file and save it.
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
|
|
|
| Re: Eclipse character encoding problem [message #779819 is a reply to message #779787] |
Mon, 16 January 2012 11:13   |
Missing name Missing name Messages: 7 Registered: December 2011 |
Junior Member |
|
|
Hi
Thanks for the reply.
If I first convert my encoding to ISO-8859-1 from Edit->Set Encoding, it seems to work after edit->save (though Eclipse adds many extra spaces and such). But it does not work at all if I convert to UTF-8.
In any case, I don't wanna convert the encoding for a 10+ years old project with >6000 files because of Eclipse, I hope there are other ways...Do you have any idea why Eclipse works differently than other Editors like Nothpad++, Codewright etc.? Can it simply save the DELTA, and not the entire file ?
Thanks.
|
|
|
| Re: Eclipse character encoding problem [message #780141 is a reply to message #779819] |
Tue, 17 January 2012 04:04   |
Axel Mueller Messages: 1829 Registered: July 2009 |
Senior Member |
|
|
Missing name Mising name wrote on Mon, 16 January 2012 17:13Hi
Thanks for the reply.
If I first convert my encoding to ISO-8859-1 from Edit->Set Encoding, it seems to work after edit->save (though Eclipse adds many extra spaces and such). But it does not work at all if I convert to UTF-8.
So when you set the default encoding in Window -> Preferences -> Workspace -> Text file encoding to ISO-8859-1 everything does work? I guess the extra spaces are caused by converting tabs to spaces. You can control this behavior in Window -> Preferences -> General->Editor->Text Editor
Also you may want to disable the save action to remove trailing white space Window -> Preferences -> C/C++->Editor->Save Actions
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
|
|
|
|
|
| Re: Eclipse character encoding problem [message #780730 is a reply to message #780584] |
Thu, 19 January 2012 03:55   |
Missing name Missing name Messages: 7 Registered: December 2011 |
Junior Member |
|
|
Hi,
You were right, I must close and then reopen the file after changing the encoding in Window -> Preferences -> Workspace -> Text file encoding (although I tested with Closing->reopening the whole workspace!). Now it works.
Also, now I have no spaces in clearcase checked-out files,safter I removed trailing white space in Window -> Preferences -> C/C++->Editor->Save Actions. I think the general recommendation is to remove trailing whites, but in this case its better not to do this, dont know why!
I have no encoding in Window -> Preferences ->General->Content types .
Thank you for your time and valuable tips.
|
|
|
| Re: Eclipse character encoding problem [message #883665 is a reply to message #780141] |
Fri, 08 June 2012 23:05   |
AM Desai Messages: 1 Registered: June 2012 |
Junior Member |
|
|
I am new to the character encoding issue in Eclipse. But i was not able to a make a change and save a (php) .module file because of an error involving the cp1252 encoding. i saw this post and changed it to ISO-8859-1, closed the file, re-opened it and everything appears to work now. so, first off, i thank for the useful feedback.
Can anybody explain to me what the deal with the character encoding is? I hope changing it from cp1252 to iso8859 will not break something else down the line..
thanks,
[Updated on: Fri, 08 June 2012 23:06] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03412 seconds