grassplugin1.patch

Minoru Akagi, 2012-10-25 11:46 PM

Download (1.33 KB)

View differences:

src/plugins/grass/qgsgrassmodule.cpp
353 353
    return;
354 354
  }
355 355

  
356
  // convert encoding of interface description by myself because
357
  // Qt doesn't recognize most of codepage name "CPxxx" currently
358
  QByteArray enc;
359
  QByteArray ifDesc = process.readAllStandardOutput();
360
  QRegExp reg( "(.+)encoding=\"(.+)\"(.+)" );
361
  if ( reg.exactMatch( ifDesc.split( '\n' )[0] ) )
362
  {
363
    enc = reg.cap( 2 ).toLocal8Bit();
364
  }
365

  
366
  QTextCodec *codec = QTextCodec::codecForName( enc );
367
  if ( !codec )
368
  {
369
    // treat codepage name that Qt doesn't recognize as System
370
    // default encoding
371
    codec = QTextCodec::codecForName( "System" );
372
    Q_ASSERT( codec );
373
  }
374

  
356 375
  QDomDocument gDoc( "task" );
357 376
  QString err;
358 377
  int line, column;
359
  if ( !gDoc.setContent( &process, false, &err, &line, &column ) )
378
  if ( !gDoc.setContent( codec->toUnicode( ifDesc ), false, &err, &line, &column ) )
360 379
  {
361 380
    QString errmsg = tr( "Cannot read module description (%1):" ).arg( mXName )
362 381
                     + tr( "\n%1\nat line %2 column %3" ).arg( err ).arg( line ).arg( column );