Cussedness

The natural cussedness of things in general.

    • « Cussedness Theme 1.0.1
    • The Adventures of Captain Hatteras by Jules Verne »
  • JavaScript and UTF-8 in Eclipse

    For some reason the usually excellent Eclipse IDE sets the default encoding of JavaScript files to ISO-8859-1, which is pretty much wrong and can be problematic.  The correct path to configuring things so that they are right is rather non-obvious; Google failed me in the quest to fix things this time. It’s a small but irritating problem, and apparently I’m not alone in seeking an answer, so I’m posting my solution up here for future reference and for any other frustrated Eclipse JavaScripters that might be out there.

    ECMAScript is supposed to support Unicode natively, so the default encoding for .js files should really be UTF-8 (or maybe UTF-16; as far as I know UTF-8 is fine, but I’m not an expert).  I installed Eclipse via the PHP Development Tools project, so it may just be a problem with the configuration from that installer.  Whatever the reason, it’s annoying if you’re trying to save a file with Unicode characters in it.  Eclipse tells you that this is impossible, and to set the correct encoding on the file in question, but if you try to do that via File Properties, nothing changes.  Here’s how to make Eclipse do what you want it to and save .js files in UTF-8.

    Open Preferences→General→Content Types, then Text→JavaScript, and set “Default encoding” to “UTF-8″, like so:

    Enable JavaScript save as UTF-8 in Eclipse

    Enable JavaScript save as UTF-8 in Eclipse

    Now you can save your JavaScript as UTF-8 just as the EMCA intended.

    0 comments • 2008-10-02 14:57 • Categories: Computers, Geek Stuff • Tags: Coding, Eclipse, Eclipse PDT, Encodings, Fix, ISO-8859-1, JavaScript, PHP Development Tools, Scripting, Unicode, UTF-8

  • Leave a Reply

    * Required values.

    XHTML: These tags are allowed in comments: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    • « Cussedness Theme 1.0.1
    • The Adventures of Captain Hatteras by Jules Verne »
  • Pages

    • About Me
    • Cussedness Theme
  • Friends

    • A Nice Cup Of Tea And A Sit Down
    • Blogjam
    • Chthonic Ionic
    • It Can Be Done
    • Peanut Jimjams
    • Rob Manuel
    • Roganjosh
    • Rory O’Sullivan
  • Other stuff I do

    • Cats In Sinks
    • Kittenwar
    • Mint Imperial
    • My Flickr Photos
    • The Daily Kitten
    • The Random Kitten Generator
  • Search

  • Tags

    Animation Apache Apple Charlotte Brontë Coding Debian Education Evolution Family Fix Futurama H. P. Lovecraft History Idiots Infrared Intelligent Design Jules Verne Kali Mountford Kittenwar Laptops Linux London Mac Mini Maps Novels OS X Pharmaceuticals Photos PHP Robots Scripting Security Statistics Tindersticks Trains Unix Victorians Voyages Extraordinaire Web Webcam Wilf Wilfred Hugh Ryan Windows Wireless Wordpress

  • Categories

  • Archives

© Tom Ryan 2006 to 2008.