Examples of QTextCodec


Examples of com.trolltech.qt.core.QTextCodec

      TidyListener tidyListener = new TidyListener(logger);
      tidy.setMessageListener(tidyListener);
      tidy.getStderr().close()// the listener will capture messages
      tidy.setXmlTags(true);
     
      QTextCodec codec;
      codec = QTextCodec.codecForName("UTF-8");
          QByteArray unicode =  codec.fromUnicode(currentNote.getContent());
         
          logger.log(logger.MEDIUM, "Starting JTidy check");
          logger.log(logger.MEDIUM, "Start of JTidy Input");
          logger.log(logger.MEDIUM, currentNote.getContent());
          logger.log(logger.MEDIUM, "End Of JTidy Input");
View Full Code Here

Examples of com.trolltech.qt.core.QTextCodec

    tidy.setMessageListener(tidyListener);
    tidy.getStderr().close()// the listener will capture messages
    tidy.setXmlTags(true);
    tidy.setXHTML(true);
   
    QTextCodec codec;
    codec = QTextCodec.codecForName("UTF-8");
        QByteArray unicode =  codec.fromUnicode(newContent);
       
//    byte html[] = newContent.getBytes();
//    ByteArrayInputStream is = new ByteArrayInputStream(html);
        logger.log(logger.HIGH, "Starting JTidy check");
        logger.log(logger.EXTREME, "Start of JTidy Input");
View Full Code Here

Examples of com.trolltech.qt.core.QTextCodec

      return true;
    return false;
  }
   
    private Note getNoteContent(Note n) {
    QTextCodec codec = QTextCodec.codecForLocale();
    codec = QTextCodec.codecForName("UTF-8");
      n.setContent(codec.toUnicode(new QByteArray(n.getContent())));
      return n;
    }
View Full Code Here

Examples of com.trolltech.qt.core.QTextCodec

      // Find the end tag
      endPos = text.indexOf(">", imagePos);
      String tag = text.substring(imagePos-1,endPos);
      if (tag.indexOf("id=\""+id+"\"") > -1) {
          text = text.substring(0,imagePos) +plainText+text.substring(endPos+1)
          QTextCodec codec = QTextCodec.codecForName("UTF-8");
              QByteArray unicode =  codec.fromUnicode(text);
          setContent(unicode);
          if (permanent)
            contentChanged();
      }
      imagePos = text.indexOf("<img", imagePos+1);
View Full Code Here

Examples of com.trolltech.qt.core.QTextCodec

    }
 
  // Source edited
  @SuppressWarnings("unused")
  private void sourceEdited() {
    QTextCodec codec = QTextCodec.codecForLocale();
    codec = QTextCodec.codecForName("UTF-8");
        String content =  codec.fromUnicode(sourceEdit.toHtml()).toString();
    content = StringEscapeUtils.unescapeHtml4(removeTags(content));
    QByteArray data = new QByteArray(sourceEditHeader+content+"</body></html>");
    getBrowser().setContent(data);
    checkNoteTitle();
    if (currentNote != null && sourceEdit != null)
View Full Code Here

Examples of com.trolltech.qt.core.QTextCodec

  private void setNoteDirty() {
    logger.log(logger.EXTREME, "Entering NeverNote.setNoteDirty()");
   
    // Find if the note is being edited externally.  If it is, update it.
    if (externalWindows.containsKey(currentNoteGuid)) {
      QTextCodec codec = QTextCodec.codecForName("UTF-8");
          QByteArray unicode =  codec.fromUnicode(browserWindow.getContent());
      ExternalBrowse window = externalWindows.get(currentNoteGuid);
        window.getBrowserWindow().setContent(unicode);
    }
   
    // If the note is dirty, then it is unsynchronized by default.
View Full Code Here

Examples of com.trolltech.qt.core.QTextCodec

    
    logger.log(logger.EXTREME, "Leaving NeverNote.setNoteDirty()");
    }
    @SuppressWarnings("unused")
  private void saveNoteExternalBrowser(String guid, String content, Boolean save, BrowserWindow browser) {
    QTextCodec codec = QTextCodec.codecForName("UTF-8");
        QByteArray unicode =  codec.fromUnicode(content);
      noteCache.remove(guid);
    noteCache.put(guid, unicode.toString());
      if (guid.equals(currentNoteGuid)) {
        noteDirty = true;
        browserWindow.setContent(unicode);
View Full Code Here

Examples of com.trolltech.qt.core.QTextCodec

    private void saveNote(String guid, BrowserWindow window) {
    logger.log(logger.EXTREME, "Inside NeverNote.saveNote()");
       waitCursor(true);
       
    logger.log(logger.EXTREME, "Saving to cache");
    QTextCodec codec = QTextCodec.codecForLocale();
//          QTextDecoder decoder = codec.makeDecoder();
    codec = QTextCodec.codecForName("UTF-8");
        QByteArray unicode =  codec.fromUnicode(window.getContent());
       noteCache.put(guid, unicode.toString());
     
       logger.log(logger.EXTREME, "updating list manager");
       listManager.updateNoteContent(guid, window.getContent());
    logger.log(logger.EXTREME, "Updating title");
View Full Code Here

Examples of com.trolltech.qt.core.QTextCodec

      n.setTagNames(tagNames);
      n.setTagGuids(tagGuids);   
    }
   
    if (loadContent) {
      QTextCodec codec = QTextCodec.codecForLocale();
      codec = QTextCodec.codecForName("UTF-8");
          String unicode =  codec.fromUnicode(query.valueString(17)).toString();

          // This is a hack.  Basically I need to convert HTML Entities to "normal" text, but if I
          // convert the &lt; character to < it will mess up the XML parsing.  So, to get around this
          // I am "bit stuffing" the &lt; to &&lt; so StringEscapeUtils doesn't unescape it.  After
          // I'm done I convert it back.
          StringBuffer buffer = new StringBuffer(unicode);
          if (Global.enableHTMLEntitiesFix && unicode.indexOf("&#") > 0) {
            unicode = query.valueString(17);
            //System.out.println(unicode);
            //unicode = unicode.replace("&lt;", "&_lt;");
            //unicode = codec.fromUnicode(StringEscapeUtils.unescapeHtml(unicode)).toString();
            //unicode = unicode.replace("&_lt;", "&lt;");
            //System.out.println("************************");
            int j=1;
            for (int i=buffer.indexOf("&#"); i != -1 && buffer.indexOf("&#", i)>0; i=buffer.indexOf("&#",i+1)) {
              j = buffer.indexOf(";",i)+1;
              if (i<j) {
                String entity = buffer.substring(i,j).toString();
                int len = entity.length()-1;
                String tempEntity = entity.substring(2, len);
                try {
                  Integer.parseInt(tempEntity);
                  entity = codec.fromUnicode(StringEscapeUtils.unescapeHtml4(entity)).toString();
                  buffer.delete(i, j);
                  buffer.insert(i, entity);
                } catch (Exception e){ }
               
              }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.