Ignore:
Timestamp:
Feb 6, 2014, 2:05:39 PM (11 years ago)
Author:
s10k
Message:

XmlTools
Oni's Mac folder use a special character (U+0192), because of this I had to change all encoding transformations to UTF8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XmlTools2/trunk/utilxmltools.cpp

    r923 r935  
    4646    if(!QFile::exists(file+".bak")){
    4747        if(!Util::backupFile(file)){
    48             std::cerr << "Couldn't backup file '" << file.toLatin1().constData() << "'. Aborting." << std::endl;
     48            std::cerr << "Couldn't backup file '" << file.toUtf8().constData() << "'. Aborting." << std::endl;
    4949            exit(1);
    5050        }
     
    5252    else{
    5353        if(verboseEnabled){
    54             std::cout << "Backup file '" << file.toLatin1().constData() << "'' already exists. Skipping..." << std::endl;
     54            std::cout << "Backup file '" << file.toUtf8().constData() << "'' already exists. Skipping..." << std::endl;
    5555        }
    5656    }
     
    6464    try
    6565    {
    66         selectedNodes = doc.select_nodes(xPathExpression.toLatin1().constData());
     66        selectedNodes = doc.select_nodes(xPathExpression.toUtf8().constData());
    6767    }
    6868
     
    9191    try
    9292    {
    93         selectedNode = doc.select_single_node(xPathExpression.toLatin1().constData());
     93        selectedNode = doc.select_single_node(xPathExpression.toUtf8().constData());
    9494    }
    9595
     
    108108        if ((*currNode).name() == filters.getElementName() && (filters.getParentElementName() == "" || filters.getParentElementName() == (*currNode).parent().name())
    109109                && (filters.getAttributeName() == "" ||
    110                     Util::toQString((*currNode).attribute(filters.getAttributeName().toLatin1().constData()).value()) == filters.getAttributeValue()) ){ // Seems node attribute must be converted to qtsring to remove \r\n needs to check in future!
     110                    Util::toQString((*currNode).attribute(filters.getAttributeName().toUtf8().constData()).value()) == filters.getAttributeValue()) ){ // Seems node attribute must be converted to qtsring to remove \r\n needs to check in future!
    111111
    112112            result << *currNode;
     
    125125        if ((*currNode).name() == filters.getElementName() && (filters.getParentElementName() == "" || filters.getParentElementName() == (*currNode).parent().name())
    126126                && (filters.getAttributeName() == "" ||
    127                     Util::toQString((*currNode).attribute(filters.getAttributeName().toLatin1().constData()).value()) == filters.getAttributeValue()) ){
     127                    Util::toQString((*currNode).attribute(filters.getAttributeName().toUtf8().constData()).value()) == filters.getAttributeValue()) ){
    128128            return *currNode;
    129129        }
     
    142142void displaySuccessMessage(const int numberOperations, const QString &operation){
    143143    std::cout << "------------------------------------------------------------------------" << std::endl;
    144     std::cout << numberOperations << " " << operation.toLatin1().constData() << " operation(s) completed with success!" << std::endl;
     144    std::cout << numberOperations << " " << operation.toUtf8().constData() << " operation(s) completed with success!" << std::endl;
    145145    std::cout << "------------------------------------------------------------------------" << std::endl;
    146146}
     
    148148void displayErrorMessage(const QString& operation, const QString &message, bool exitProgram){
    149149    std::cerr << "************************************************************************" << std::endl;
    150     std::cerr << operation.toLatin1().constData() << " operation failed!" << std::endl << std::endl;
    151     std::cerr << message.toLatin1().constData() << std::endl << std::endl;
     150    std::cerr << operation.toUtf8().constData() << " operation failed!" << std::endl << std::endl;
     151    std::cerr << message.toUtf8().constData() << std::endl << std::endl;
    152152    if(exitProgram) std::cerr << "Aborting..." << std::endl;
    153153    std::cerr << "************************************************************************" << std::endl;
Note: See TracChangeset for help on using the changeset viewer.