Greetings all,

Is it possible to detect errors while encoding a QString from char*?

Here's the case: I get a string as a char* form an external library (on which I 
don't have any control).
This string can use either UTF8 encoding, or "local8bit" encoding - thus may 
vary from a user to the other.

What I basically need is to be table to write something like this:
char const* src = ...;
bool encoding_failed = false;
QString qs = QString::fromUtf8(src, &encoding_failed);
if ( encoding_failed )
{
  qs = QString::fromLocal8Bit(src);
}

I looked at the docs for QString and QTextCodec, but I couldn't find any error 
support.

Is there any (portable) way of achieving this?

Thanks in advance for any hint.

--
Yves Bailly
Software developer


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to