Menu

#132 fix for getXMLEncoding()

closed-fixed
None
5
2007-09-08
2007-09-06
No

Hello,

attached patch is for org/gjt/sp/jedit/io/XMLEncodingDetector.java (Revision 10456)

The function Charset.isSupported() does not return false if an unsupported encoding is given but throws an IllegalCharsetNameException.
Therefore it is not possible to open files with a wrong/unsupported encoding or use hypersearch in directories that contain such files.

The bug can be reproduced by creating a file with the following line in it:

<?xml version="1.0" encoding="{@CHARSET}"?>

(this is part of a template file from wotlab burning board 3)

The fix catches this exception, adds a message to the log and returns null.

Greetings Andre

Discussion

  • Andre Rudlaff

    Andre Rudlaff - 2007-09-06

    patch for XMLEncodingDetector.java

     
  • Alan Ezust

    Alan Ezust - 2007-09-06
    • assigned_to: nobody --> k_satoda
     
  • Kazutoshi Satoda

    • status: open --> closed-fixed
     
  • Kazutoshi Satoda

    Logged In: YES
    user_id=1483238
    Originator: NO

    The problem was fixed in r10464. The same problem was in
    [Reload with Encoding] action too. Thank you for reporting and writing
    the concrete patch. It helped much.

    FYI, Charset.isSupported() does return false for unsuppoted encoding
    names which are also "legal". Such encoding names like "{@CHARSET}" are
    illegal rather than unsupported according to the following spec.
    http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/Charset.html#names

    I was disappointed to see that a method like Charset.isLegal() does not
    exist.

     

Log in to post a comment.