#49 Automatic tweak of encoding declaration in buffer

open
nobody
plugins (29)
5
2011-12-08
2006-08-23
Tom Eugelink
No

JEdit supports encoding detection on unicode files
using the ByteOrderMarker. However XML and associated
files have a most specific encoding marker: in the <?
xml encoding="..."?>

Eclipse Web Tools Platform handles this brilliantly:
if you change the encoding in the <?xml tag, the file
is automatically saved in the corresponding encoding!
No more manual encoding changing. And problems with
the conversion are reported.

So a file with:

<?xml version="1.0" encoding="iso-8859-1"?>

Is assumed to be in this encoding when read (update
buffer encoding setting after load) and is force-saved
in this encoding. When text is changed to:

<?xml version="1.0" encoding="utf-16"?>

and then saved, the buffer encoding is prio to saving
automatically changed to UTF-16 and the file is thus
saved. Maybe it is even possible to change the
encoding on-the-fly when the text is changed and the
line is exited?

Discussion

  • YpsiloN
    YpsiloN
    2006-08-25

    Logged In: YES
    user_id=1570477

    same thing please for the HTML/XHTML files with the tag:
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8">

     
  • jEdit detects encoding with XML-PI by default. An option to detect
    charset declaration in HMTL's meta tag was added in r13639.

    The remaining feature in this request is, automatic tweak of encoding
    declaration in buffer.

     
    • summary: XML, XSL, XSD ... encoding --> Automatic tweak of encoding declaration in buffer
     
  • Alan Ezust
    Alan Ezust
    2011-11-30

    now there is an html and xml encoding recognizer, so this feature request is closed.

     
  • Alan Ezust
    Alan Ezust
    2011-11-30

    • assigned_to: nobody --> k_satoda
    • status: open --> closed-fixed
     
    • assigned_to: k_satoda --> nobody
    • status: closed-fixed --> open
     
  • This request is not only for detection, but also for automatic tweak of
    encoding declaration in a buffer, and automatic change of encoding on
    save after editing the declaration. They are still missing.

     
  • Please leave the user opportunity to override such automatic change of encoding. On load it can be overriden by manually choosing the encoding. If there will be no such possibility on save, then at least turning off the encoding detector in global properties should make the automat stop working.

    I was also working on an editor that did it automatically. I did not always like it.