0

I'm using Eclipse in Ubuntu to edit PHP files.

But, unfortunately, some of these PHP files were created in Notepad++ in Windows XP, with ANSI encoding defined.

Also, these files generates HTML codes with charset=ISO-8859-1.

When I configured Eclipse to ISO-8859-1, many special characters were lost and changed to '???', and when I try to save a file with ISO enconding, Eclipse displays an error that was not possible to save the file because some characters aren't compatible with the charset.

How can I save these files without changing the encoding, or how can I change the encoding without lose characters.

Paulo Coghi
  • 13,724
  • 14
  • 68
  • 90

3 Answers3

3

To the point, you need to read those files using ANSI encoding and then write those files using ISO-8859-1 encoding. In Notepad++ you can change the encoding by Format menu option. Unfortunately there's no ISO-8859-1 option, but UTF-8 should suffice and is nowadays also the preferred choice for world domination since the ISO-8859-1 encoding only covers latin characters, not for example Cyrillic, Greek, Chinese, Arabic, etcetera.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • 1
    ISO-8859-5 is for Slavic or Cyrillic, ISO-8859-7 for modern Greek, ISO-8859-6 for Arabic. You can encode many languages with the ISO-8859 group, you just cannot *combine* them. Anyway, UTF-8 is the way to go. – fuxia Apr 13 '10 at 18:22
2

By "ANSI" do you mean "Windows code page 1252"?

In either case, once you figure out the source encoding you can use iconv to convert from that encoding to UTF-8.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
1

The latest version can CONVERT between ISO-8859-1 and UTF-8 without loosing info. version 5.6.8 is able to do so.

MikeyKennethR
  • 600
  • 4
  • 16