- /** Convert all non-ascii characters to question marks */

-  static const QCString toUsAscii(const QString& _str);
+  /** Convert all non-ascii characters to question marks
+    * If ok is non-null, *ok will be set to true if all characters
+    * where ascii, *ok will be set to false otherwise */
+  static const QCString toUsAscii(const QString& _str, bool *ok=0);

svn path=/trunk/kdenetwork/kmail/; revision=120665
wilder-work
Waldo Bastian 25 years ago
parent d5fc2361c4
commit 6bda214b0e
  1. 12
      kmmsgbase.cpp
  2. 6
      kmmsgbase.h

@ -190,12 +190,18 @@ QTextCodec* KMMsgBase::codecForName(const QCString& _str)
//-----------------------------------------------------------------------------
const QCString KMMsgBase::toUsAscii(const QString& _str)
const QCString KMMsgBase::toUsAscii(const QString& _str, bool *ok)
{
QString result = _str;
bool all_ok =true;
QString result = _str;
int len = result.length();
for (int i = 0; i < len; i++)
if (result.at(i).unicode() >= 128) result.at(i) = '?';
if (result.at(i).unicode() >= 128) {
result.at(i) = '?';
all_ok = false;
}
if (ok)
*ok = all_ok;
return result.latin1();
}

@ -117,8 +117,10 @@ public:
* This function is a bit more tolerant, than QTextCodec::codecForName */
static QTextCodec* codecForName(const QCString& _str);
/** Convert all non-ascii characters to question marks */
static const QCString toUsAscii(const QString& _str);
/** Convert all non-ascii characters to question marks
* If ok is non-null, *ok will be set to true if all characters
* where ascii, *ok will be set to false otherwise */
static const QCString toUsAscii(const QString& _str, bool *ok=0);
/** Return a list of the supported encodings */
static QStringList supportedEncodings(bool usAscii);

Loading…
Cancel
Save