private static String getCharSet(ChangedCharSetException e) { String spec = e.getCharSetSpec(); if (e.keyEqualsCharSet()) {
/** * Method for loading HTML document */ public void loadDocument(File whatFile) throws IOException, BadLocationException { try { loadDocument(whatFile, null); } catch (ChangedCharSetException ccse) { String charsetType = ccse.getCharSetSpec().toLowerCase(); int pos = charsetType.indexOf("charset"); if (pos == -1) { throw ccse; } while (pos < charsetType.length() && charsetType.charAt(pos) != '=') { pos++; } pos++; // Places file cursor past the equals sign (=) String whatEncoding = charsetType.substring(pos).trim(); loadDocument(whatFile, whatEncoding); } refreshOnUpdate(); }
String spec = e.getCharSetSpec(); if (e.keyEqualsCharSet()) {
/** * Method to invoke loading HTML into the app */ private void openDocument(File whatFile) throws IOException, BadLocationException { if (whatFile == null) { whatFile = getFileFromChooser(".", JFileChooser.OPEN_DIALOG, extsHTML, Translatrix .getTranslationString("FiletypeHTML")); } if (whatFile != null) { try { loadDocument(whatFile, null); } catch (ChangedCharSetException ccse) { String charsetType = ccse.getCharSetSpec().toLowerCase(); int pos = charsetType.indexOf("charset"); if (pos == -1) { throw ccse; } while (pos < charsetType.length() && charsetType.charAt(pos) != '=') { pos++; } pos++; // Places file cursor past the equals sign (=) String whatEncoding = charsetType.substring(pos).trim(); loadDocument(whatFile, whatEncoding); } } refreshOnUpdate(); }
MimeType mimeType = new MimeType(e.getCharSetSpec()); String charset = mimeType.getParameter("charset");
charsetGuess = ccse.getCharSetSpec(); int begin = charsetGuess.indexOf("charset="); if (begin > 0)
charsetGuess = ccse.getCharSetSpec(); int begin = charsetGuess.indexOf("charset="); if (begin > 0)