简体   繁体   中英

Save Could not be completed. ECLIPSE ERROR

Save could not be completed. Reason: Some characters cannot be mapped using "Cp1252" character encoding. Either change the encoding or remove the characters which are not supported by the "Cp1252" character encoding.

This is my problem while trying to change some of the codes of my project.and when I Remove the character or save as utf-8 the project will not run. Please Help me. Thank you so much in advance.

Remove all character/word in your class that are in language except English like japaneze or chaineaze etc.

otherwise

just copy your class from Eclipse and paste it to your System at any Location (C/desktop) and open it with your Editor (Notepad/Wordpad) and Edit it and save it and again copy it to your Eclipse> your project> your package

Thanks

This might also happen when you try to do copy paste of code from other places such as PDF. The reason for this is because the eclipse doesn't all the time understand the characters that are from a PDF file.

The answer for this is to rewrite the code, or maybe copy pasting this through notepad (I personally never tried to copy through notepad)

I received a similar message when trying to edit a file in Eclipse. When I saved as UTF-8 I lost some of the characters in my document. I was able to get around this by:

  1. Opening the file
  2. Go to Edit > Set encoding...
  3. Select Other
  4. Select ISO-8859-1

I had the same problem.

I put the file into Notepad and saved it. Notepad will tell you that some of the characters will be lost. The ones you are loosing are those hidden or hard to identify characters. Then you take that very text file you just stored and paste it into eclipse or whatever you are using.

When my version of eclipse (ADT 22) showed this message, the pop up error window presented the choice

"Find First Character."

Using this option will show you the offending characters in the file. In my case they were in a //COMMENT! so I just delete them. Save then worked.

You can solve this in 2 simple steps:

1) change the encoding settings of the file (Alt+Enter) to be UTF-8 or whatever you need.

2) Save the file in the editor.

I faced the same problem in eclipse. Then I found out that the file permissions somehow got changed. The problem was resolved once the write permission was added

When I have this issue, I save as utf-8 and there is no problem anymore.
If you save like this and it still doesn't work, there must be an error with the code. Sometimes, in XML, you have letters like this: đšćčš and that can be a problem.

Copy your codes > open notepad > save file > copy your codes from notepad > paste eclipse.

And save it.

Eclipse has been known (from my personal experience) to change the encoding of a file (perhaps I accidentally pressed a shortcut key).. but it is not obvious from the settings that the file encoding has changed. The eclipse file settings seemed to imply they were all inherited and all US-ASCII. Then I went to use vi and tried the :set command (on a MacOS system), and found that the rest of my files were in UTF-8, but this one that was getting this problem, was in Latin1. "Save as UTF-8" solved the problem. Still don't know how it switched to Latin1.

Use this regular expression - [^\\x00-\\x7F] to find all non-standard characters and replace them with nothing. That worked for me.

This happened to me, when i had copied a source-code containing asian characters.

.append("월 ] ")

just use "saved UTF-8"

File img=new File("C:\\Users\\Ramakrishna\\Desktop\\Atal.jpg");

or

File img=new File("C:/Users/Ramakrishna/Desktop/Atal.jpg");

This line gave me problem. But the above solutions could not help me.I created a new package and recreated the class and wrote same line of code later it worked.

I faced the same issue, Then just copied all texts from the file and closed the file. Reopened it and pasted, this time eclipse allowed saving the file.

If you are using maven and you just added some reporting plugins (in my case was: com.fasterxml.jackson.core ). You can fix it by adding this to your pom.xml :

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

Here's the detail: How to configure encoding in Maven?

In Eclipse -

  1. Change the encoding settings of the file by --> Alt+Enter select - UTF-8 or whatever you need.

  2. Save the file.

  3. Error is gone :)

I was able to correct this problem in Eclipse by clicking File -> Properties. Then in Resource -> "Text file encoding" set to Other -> UTF-8. Though my problem was a little different. I wasn't able to save this character in ISO-8859-1.

Open the Source Code from the workspace(C:\\Documents and Settings\\Administrator\\workspace\\myfiori_1) in the notepad or wordpad and save it there. It will be reflected here on eclipse.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM