my2cents

5. August, 2008

Character encoding error from Eclipse while saving

Filed under: Apple & Mac,Software Development — frightanic @ 17:05

This blog now resides at http://www.frightanic.com/. It will be discontinued here…

What to do when the following error pops up in Eclipse while saving a file:

Save could not be Completed
Reason:
Some characters cannot be mapped using “<your-encoding-here>” character encoding.
Either change the encoding or remove the characters which are not supported by the “
<your-encoding-here>” character encoding.

If you’re certain that the encoding is correct an you didn’t enter any weired characters, you should copy/paste the content of the file to an external editor and see if it tells you where those hidden, special characters are.

On Linux and Mac you may as well abuse the terminal for that for certain character set. Just paste the code to the shell and see if you find anything unusual.

Advertisements

2 Comments

  1. What I’d love to know is what to do when that fails…

    Every once in a while, I end up pasting something in that completely refuses to save, even though nothing odd shows in the terminal — even trying to paste-copy again-paste again. Even going in to TextEdit, pasting, choose make plain text, copying, and pasting again just doesn’t work. Retyping, character-by-character is often the only solution. And that’s a non-starter if we’re talking a large amount of text.

    My solution? Open emacs and do the paste there, and save it. Eclipse will see the change and ask to reload the file. All good, but very annoying. (It’s gotta be some bug with the way eclipse handles pasting text.)

    Comment by Shane — 19. August, 2009 @ 21:54

  2. could be smart quotations ” ” that come from sources with directional curls!
    that was my problem.

    Comment by paul rupil — 8. February, 2010 @ 09:20


RSS feed for comments on this post.

Create a free website or blog at WordPress.com.

%d bloggers like this: