It will affect all (const char*) to QString and the other way around conversions from the moment it is called.
Pretty clear.
Regards
It will affect all (const char*) to QString and the other way around conversions from the moment it is called.
Pretty clear.
Regards
conexion2000 (10th August 2007)
Even those that are located in dll's? And Qt libs itself?
How can I inform library itself about used encoding?
Yes, everything.
If you set a code for C strings and call a function located in a dll, like this(assuming the function takes a QString parameter):
Then the QString built from the const char* will be affected by the codec.Qt Code:
dllFunction("String with weird encoding");To copy to clipboard, switch view to plain text mode
If you don't want this behavior then you could define sections in your applications in which you set the code to NULL, do some stuff, and set it back to utf8.
EDIT: you can make a global variable and/or function in your lib that you use as some sort of initializer.
For example:
Qt Code:
setLibraryCodec(currentCodec);To copy to clipboard, switch view to plain text mode
Regards
I rather meant internal functions in a library. Assuming returnString() belongs to SomeLib which is compiled as DLL:
Will be some string encoded in a codec set in main app?QString SomeLib::returnString()
{
//do some stuff
QString someString("here it goes..");
//do here something
}
Yes, if you call this function in the context of the application, then I believe it will.
It is better to test it, since I could be wrong.
However, it does not make any sense not to apply the codec since QString has a static QTextCode member which is set by setCodecForCStrings.
Therefore every QString built after this member is set will be affected.
Regards
conexion2000 (10th August 2007)
Bookmarks