Example #1
0
static int
ensureEncodingSet()
{
    if (!_encodingSet) {
	setEncoding(getenv("LC_ALL"));

	if (!_encodingSet) {
	    setEncoding(getenv("LC_CTYPE"));

	    if (!_encodingSet) {
		setEncoding(getenv("LANG"));

		if (!_encodingSet) {
		    errMsg("Character encoding not specified and not settable "
                        "from environment variables LC_ALL, LC_CTYPE, or LANG. "
                        "Assuming ASCII encoding.");

		    setEncoding("ASCII");
		}
	    }
	}
    }

    if (_encodingSet)
	_formattingOptions |= _encoding;

    return _encodingSet;
}
Example #2
0
void c_UConverter::t___construct(const String& toEncoding,
                                 const String& fromEncoding) {
    setEncoding(toEncoding,   &m_dest, &m_error);
    setEncoding(fromEncoding, &m_src,  &m_error);
    setCallback(m_dest);
    setCallback(m_src);
}
Example #3
0
bool HuffmanTree::setEncoding(BST<CharFreq>::BSTNode *nodePtr, string encode)
{
  if(nodePtr == nullptr)
	return false;
  else
	{

	  if(nodePtr->left == nullptr && nodePtr->right == nullptr)
		nodePtr->data.encoding = encode;
	  
	  if(nodePtr->left)
		{
		  encode += "0";
		  setEncoding(nodePtr->left, encode);
		  encode.pop_back();
		}
	  if(nodePtr->right)
		{
		  encode += "1";
		  setEncoding(nodePtr->right, encode);
		  encode.pop_back();
		}

	  return true;
	}
  return false;
}
Example #4
0
ofdocstream::ofdocstream(const char* s, ios_base::openmode mode,
			 string const & encoding)
	: base()
{
	setEncoding(*this, encoding, out);
	open(s, mode);
}
Example #5
0
void
KSpellConfig::sChangeEncoding( int i )
{
  kdDebug(750) << "KSpellConfig::sChangeEncoding(" << i << ")" << endl;
  setEncoding( i );
  emit configChanged();
}
Example #6
0
void getPCMInformation(int indentLevel, int portNumber) {
    /* assert: PCM is a supported mode */
    OMX_AUDIO_PARAM_PCMMODETYPE sPCMMode;

    /* set it into PCM format before asking for PCM info */
    if (setEncoding(portNumber, OMX_AUDIO_CodingPCM) != OMX_ErrorNone) {
	fprintf(stderr, "Error in setting coding to PCM\n");
	return;
    }
       
    setHeader(&sPCMMode, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
    sPCMMode.nPortIndex = portNumber;
    err = OMX_GetParameter(handle, OMX_IndexParamAudioPcm, &sPCMMode);
    if(err != OMX_ErrorNone){
	indent printf("PCM mode unsupported\n");
    } else {
	indent printf("  PCM default sampling rate %d\n", sPCMMode.nSamplingRate);
	indent printf("  PCM default bits per sample %d\n", sPCMMode.nBitPerSample);
	indent printf("  PCM default number of channels %d\n", sPCMMode.nChannels);
    }      

    /*
    setHeader(&sAudioPortFormat, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE));
    sAudioPortFormat.nIndex = 0;
    sAudioPortFormat.nPortIndex = portNumber;
    */

    
}
Example #7
0
// $$$ ToDo:  Xerces' InputSource class does not yet have a copy
// constructor or assignment operator.  See bug #7944.
XSLTInputSource::XSLTInputSource(
            const XSLTInputSource&  theSource,
            MemoryManager&          theMemoryManager) :
    InputSource(&theMemoryManager),
    m_stream(theSource.m_stream),
    m_node(theSource.m_node)
{
    setIssueFatalErrorIfNotFound(theSource.getIssueFatalErrorIfNotFound());

    const XMLCh*    theValue = theSource.getSystemId();

    if (theValue != 0)
    {
        setSystemId(theValue);
    }

    theValue = theSource.getPublicId();

    if (theValue != 0)
    {
        setPublicId(theValue);
    }

    theValue = theSource.getEncoding();

    if (theValue != 0)
    {
        setEncoding(theValue);
    }
}
ImportCsvDialog::ImportCsvDialog(const QString& filename, DBBrowserDB* db, QWidget* parent)
    : QDialog(parent),
      ui(new Ui::ImportCsvDialog),
      csvFilename(filename),
      pdb(db)
{
    ui->setupUi(this);

    // Get the actual file name out of the provided path and use it as the default table name for import
    QFileInfo file(filename);
    ui->editName->setText(file.baseName());

    // Create a list of all available encodings and create an auto completion list from them
    QStringList encodingList;
    foreach(QString enc, QTextCodec::availableCodecs())
        encodingList.push_back(enc);
    encodingCompleter = new QCompleter(encodingList, this);
    encodingCompleter->setCaseSensitivity(Qt::CaseInsensitive);
    ui->editCustomEncoding->setCompleter(encodingCompleter);

    // Load last used settings and apply them
    QSettings settings(QApplication::organizationName(), QApplication::organizationName());
    ui->checkboxHeader->setChecked(settings.value("importcsv/firstrowheader", false).toBool());
    ui->checkBoxTrimFields->setChecked(settings.value("importcsv/trimfields", true).toBool());
    setSeparatorChar(QChar(settings.value("importcsv/separator", ',').toInt()));
    setQuoteChar(QChar(settings.value("importcsv/quotecharacter", '"').toInt()));
    setEncoding(settings.value("importcsv/encoding", "UTF-8").toString());

    // Initialise user interface
    checkInput();
    updatePreview();
}
Example #9
0
ImportCsvDialog::ImportCsvDialog(const QString& filename, DBBrowserDB* db, QWidget* parent)
    : QDialog(parent),
      ui(new Ui::ImportCsvDialog),
      csvFilename(filename),
      pdb(db)
{
    ui->setupUi(this);

    QStringList encodingList;
    foreach(QString enc, QTextCodec::availableCodecs())
        encodingList.push_back(enc);
    encodingCompleter = new QCompleter(encodingList, this);
    encodingCompleter->setCaseSensitivity(Qt::CaseInsensitive);
    ui->editCustomEncoding->setCompleter(encodingCompleter);

    QSettings settings(QApplication::organizationName(), QApplication::organizationName());
    ui->checkboxHeader->setChecked(settings.value("importcsv/firstrowheader", false).toBool());
    ui->checkBoxTrimFields->setChecked(settings.value("importcsv/trimfields", true).toBool());
    setSeparatorChar(QChar(settings.value("importcsv/separator", 44).toInt()));
    setQuoteChar(QChar(settings.value("importcsv/quotecharacter", 34).toInt()));
    setEncoding(settings.value("importcsv/encoding", "UTF-8").toString());

    checkInput();
    updatePreview();
}
void MailSyncSourceConfig::assign(const MailSyncSourceConfig& sc) {
    setName     (sc.getName     ());
    setURI      (sc.getURI      ());
    setSyncModes(sc.getSyncModes());
    setType     (sc.getType     ());
    setSync     (sc.getSync     ());
    setLast     (sc.getLast     ());

    setEncoding      (sc.getEncoding      ());
    setVersion       (sc.getVersion       ());
    setSupportedTypes(sc.getSupportedTypes());
    //setCtCap         (sc.getCtCap         ());
    setEncryption    (sc.getEncryption    ());

    setDownloadAge(sc.getDownloadAge());
    setBodySize(sc.getBodySize());
    setAttachSize(sc.getAttachSize());

    setInbox(sc.getInbox());
    setOutbox(sc.getOutbox());
    setSent(sc.getSent());
    setTrash(sc.getTrash());
    setDraft(sc.getDraft());
    setSchedule(sc.getSchedule());
    mailAccounts = sc.getMailAccounts();
}
Example #11
0
XSLTInputSource&
XSLTInputSource::operator=(const XSLTInputSource&   theRHS)
{
    if (this != &theRHS)
    {
        m_stream = theRHS.m_stream;
        m_node = theRHS.m_node;

        setIssueFatalErrorIfNotFound(theRHS.getIssueFatalErrorIfNotFound());

        const XMLCh*    theValue = theRHS.getSystemId();

        if (theValue != 0)
        {
            setSystemId(theValue);
        }

        theValue = theRHS.getPublicId();

        if (theValue != 0)
        {
            setPublicId(theValue);
        }

        theValue = theRHS.getEncoding();

        if (theValue != 0)
        {
            setEncoding(theValue);
        }

    }

    return *this;
}
QgsVectorDataProvider::QgsVectorDataProvider( const QString& uri )
    : QgsDataProvider( uri )
    , mCacheMinMaxDirty( true )
{
  QSettings settings;
  setEncoding( settings.value( QStringLiteral( "/UI/encoding" ), "System" ).toString() );
}
Example #13
0
XmlDocument::XmlDocument( const std::string &encoding,
						 const std::string &styleSheet )
						 : m_styleSheet( styleSheet )
						 , m_rootElement( new XmlElement( "DummyRoot" ) )
						 , m_standalone( true )
{
	setEncoding( encoding );
}
Example #14
0
void CachedResource::responseReceived(const ResourceResponse& response)
{
    setResponse(response);
    m_responseTimestamp = currentTime();
    String encoding = response.textEncodingName();
    if (!encoding.isNull())
        setEncoding(encoding);
}
QgsVectorDataProvider::QgsVectorDataProvider( QString uri )
    : QgsDataProvider( uri )
    , mCacheMinMaxDirty( true )
    , mFetchFeaturesWithoutGeom( true )
{
  QSettings settings;
  setEncoding( settings.value( "/UI/encoding", QString( "System" ) ).toString() );
}
Example #16
0
QgsVectorDataProvider::QgsVectorDataProvider( const QString& uri )
    : QgsDataProvider( uri )
    , mCacheMinMaxDirty( true )
    , mAttrPalIndexName( QgsAttrPalIndexNameHash() )
{
  QSettings settings;
  setEncoding( settings.value( "/UI/encoding", "System" ).toString() );
}
Example #17
0
void CachedResource::responseReceived(const ResourceResponse& response)
{
    setResponse(response);
    m_responseTimestamp = std::chrono::system_clock::now();
    String encoding = response.textEncodingName();
    if (!encoding.isNull())
        setEncoding(encoding);
}
Example #18
0
void body::setContents(ref <const contentHandler> contents, const mediaType& type,
                       const charset& chset, const encoding& enc)
{
    m_contents = contents;

    setContentType(type, chset);
    setEncoding(enc);
}
Example #19
0
void JConsoleHandler::configure() {
    //TODO JLogManager* manager = JLogManager::getLogManager();
    //TODO JString cname = getClass()->getName();

    setLevel(JLevel::INFO);//TODO manager.getLevelProperty(cname +".level", Level.INFO));
    setFilter(NULL);//TODO manager.getFilterProperty(cname +".filter", null));
    setFormatter(new JSimpleFormatter());//TODO manager.getFormatterProperty(cname +".formatter", new SimpleFormatter()));
    try {
        setEncoding("");//TODO manager.getStringProperty(cname +".encoding", null));
    } catch (JException* ex) {
        delete ex;
        try {
            setEncoding("");
        } catch (JException* ex2) {
            delete ex2;
        }
    }
}
Example #20
0
ContentSelectorModel::ContentModel::ContentModel(QObject *parent) :
    QAbstractTableModel(parent),
    mMimeType ("application/omwcontent"),
    mMimeTypes (QStringList() << mMimeType),
    mColumnCount (1),
    mDragDropFlags (Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled),
    mDropActions (Qt::CopyAction | Qt::MoveAction)
{
    setEncoding ("win1252");
    uncheckAll();
}
Example #21
0
            void JSocketHandler::configure() {
                //TODO JLogManager* manager = JLogManager::getLogManager();
                JString cname = getClass()->getName();

                setLevel(JLevel::ALL);//TODO manager.getLevelProperty(cname +".level", Level.ALL));
                setFilter(NULL);//TODO manager.getFilterProperty(cname +".filter", null));
                setFormatter(new JXMLFormatter());//TODO manager.getFormatterProperty(cname +".formatter", new XMLFormatter()));
                try {
                    setEncoding("");//TODOmanager.getStringProperty(cname +".encoding", null));
                } catch (JException* ex) {
                    delete ex;
                    try {
                        setEncoding("");
                    } catch (JException* ex2) {
                        delete ex2;
                    }
                }
                port = 0;//TODO manager.getIntProperty(cname + ".port", 0);
                host = new JString("localhost");//TODO manager.getStringProperty(cname + ".host", null);
            }
Example #22
0
void handleHead() {
    setProjection(getCoordinateSystem());
    
    long lines = getSOSILinesLength();
    for (int i = 0; i < lines; i++) {
        char* line = getSOSILine(i);
        if (line != NULL && strncmp(line, "..TEGNSETT ", 11) == 0) {
            setEncoding(line+11);
        }
    }
}
Example #23
0
EncodingFileDialog::EncodingFileDialog(QWidget *parent, const QString &caption
        , const QString &directory, const QString &filter, const QString &encoding)
: QFileDialog(parent, caption, directory, filter), combo(new EncodingComboBox(this)) {
    auto grid = qobject_cast<QGridLayout*>(layout());
    if (grid) {
        const int row = grid->rowCount();
        grid->addWidget(new QLabel(tr("Encoding") % ':', this), row, 0, 1, 1);
        grid->addWidget(combo, row, 1, 1, grid->columnCount()-1);
    }
    if (!encoding.isEmpty())
        setEncoding(encoding);
}
Example #24
0
void ContentTransferEncoding::parse( const EString &s )
{
    EmailParser p( s );

    EString t = p.mimeValue().lower();
    p.comment();
    // XXX shouldn't we do p.end() here and record parse errors?

    if ( t == "7bit" || t == "8bit" || t == "8bits" || t == "binary" ||
         t == "unknown" )
        setEncoding( EString::Binary );
    else if ( t == "quoted-printable" )
        setEncoding( EString::QP );
    else if ( t == "base64" )
        setEncoding( EString::Base64 );
    else if ( t == "x-uuencode" || t == "uuencode" )
        setEncoding( EString::Uuencode );
    else if ( t.contains( "bit" ) && t[0] >= '0' && t[0] <= '9' )
        setEncoding( EString::Binary );
    else
        setError( "Invalid c-t-e value: " + t.quoted() );
}
Example #25
0
bool Parser::setEncoding(std::string const & e, int const & p)
{
	// We may (and need to) use unsafe encodings here: Since the text is
	// converted to unicode while reading from is_, we never see text in
	// the original encoding of the parser, but operate on utf8 strings
	// instead. Therefore, we cannot misparse high bytes as {, } or \\.
	Encoding const * const enc = encodings.fromLaTeXName(e, p, true);
	if (!enc) {
		cerr << "Unknown encoding " << e << ". Ignoring." << std::endl;
		return false;
	}
	return setEncoding(enc->iconvName());
}
void KMMsgPartDialogCompat::setMsgPart( KMMessagePart * aMsgPart )
{
  mMsgPart = aMsgPart;
  assert( mMsgPart );

  QByteArray enc = mMsgPart->cteStr();
  if ( enc == "7bit" )
    setEncoding( SevenBit );
  else if ( enc == "8bit" )
    setEncoding( EightBit );
  else if ( enc == "quoted-printable" )
    setEncoding( QuotedPrintable );
  else
    setEncoding( Base64 );

  setDescription( mMsgPart->contentDescription() );
  setFileName( mMsgPart->fileName() );
  setMimeType( mMsgPart->typeStr(), mMsgPart->subtypeStr() );
  setSize( mMsgPart->decodedSize() );
  QString cd(mMsgPart->contentDisposition());
  setInline( cd.indexOf( QRegExp("^\\s*inline", Qt::CaseInsensitive) ) >= 0 );
}
Example #27
0
bool
KSpellConfig::readGlobalSettings()
{
  TDEConfigGroupSaver cs( kc,"KSpell" );

  setNoRootAffix   ( kc->readNumEntry("KSpell_NoRootAffix", 0) );
  setRunTogether   ( kc->readNumEntry("KSpell_RunTogether", 0) );
  setDictionary    ( kc->readEntry("KSpell_Dictionary") );
  setDictFromList  ( kc->readNumEntry("KSpell_DictFromList", false) );
  setEncoding ( kc->readNumEntry ("KSpell_Encoding", KS_E_UTF8) );
  setClient ( kc->readNumEntry ("KSpell_Client", KS_CLIENT_ISPELL) );

  return true;
}
Example #28
0
void
KSpellConfig::operator= (const KSpellConfig &ksc)
{
  //We want to copy the data members, but not the
  //pointers to the child widgets
  setNoRootAffix (ksc.noRootAffix());
  setRunTogether (ksc.runTogether());
  setDictionary (ksc.dictionary());
  setDictFromList (ksc.dictFromList());
  //  setPersonalDict (ksc.personalDict());
  setEncoding (ksc.encoding());
  setClient (ksc.client());

  fillInDialog();
}
bool KCHMViewWindow_KHTMLPart::openPage (const QString& url)
{
	// Set or change the encoding
	if ( m_currentEncoding != ::mainWindow->chmFile()->currentEncoding()
	&& appConfig.m_advAutodetectEncoding )
	{
		m_currentEncoding = ::mainWindow->chmFile()->currentEncoding();
		setEncoding ( m_currentEncoding->qtcodec, TRUE );
	}
	
	QString fullurl = "ms-its:" + ::mainWindow->getOpenedFileName() + "::" + url;
	KHTMLPart::openUrl ( KUrl(fullurl) );
	
	return true;
}
Example #30
0
StandardFeed::StandardFeed(const QSqlRecord& record) : Feed(record) {
  setEncoding(record.value(FDS_DB_ENCODING_INDEX).toString());
  setPasswordProtected(record.value(FDS_DB_PROTECTED_INDEX).toBool());
  setUsername(record.value(FDS_DB_USERNAME_INDEX).toString());

  if (record.value(FDS_DB_PASSWORD_INDEX).toString().isEmpty()) {
    setPassword(record.value(FDS_DB_PASSWORD_INDEX).toString());
  }
  else {
    setPassword(TextFactory::decrypt(record.value(FDS_DB_PASSWORD_INDEX).toString()));
  }

  setAutoUpdateType(static_cast<Feed::AutoUpdateType>(record.value(FDS_DB_UPDATE_TYPE_INDEX).toInt()));
  setAutoUpdateInitialInterval(record.value(FDS_DB_UPDATE_INTERVAL_INDEX).toInt());
  m_networkError = QNetworkReply::NoError;
}