Page MenuHomePhorge

No OneTemporary

diff --git a/kdecore/tests/kcharsetstest.cpp b/kdecore/tests/kcharsetstest.cpp
index 66d44e74f2..e47fec07b6 100644
--- a/kdecore/tests/kcharsetstest.cpp
+++ b/kdecore/tests/kcharsetstest.cpp
@@ -1,30 +1,34 @@
#include <kcharsets.h>
#include <kdebug.h>
#include <QtCore/QString>
#include <assert.h>
int main()
{
// Note: ctest sets LANG=C, while running the test directly uses your real $LANG.
// And since the static initializer runs before main, we cannot setenv("LANG") here,
// it's too late.
//kDebug() << "LANG=" << getenv("LANG");
//kDebug() << "LC_ALL=" << getenv("LC_ALL");
// Test that toLocal8Bit works even without a QCoreApplication,
// thanks to the static initializer in KCatalog.
// Do NOT move this code to a QTestLib unit test ;-)
QString one = QString::fromUtf8("é");
QByteArray one8bit = one.toLocal8Bit();
- if (qgetenv("LANG").endsWith("UTF-8")) { // krazy:exclude=strings
+ QByteArray lang = qgetenv("LC_ALL");
+ if (lang.isEmpty()) {
+ lang = qgetenv("LANG");
+ }
+ if (lang.endsWith("UTF-8")) { // krazy:exclude=strings
kDebug() << one << one8bit;
Q_ASSERT(one8bit.length() == 2);
}
QString input( "&lt;Hello &amp;World&gt;" );
QString output = KCharsets::resolveEntities( input );
assert( output == "<Hello &World>" );
return 0;
}

File Metadata

Mime Type
text/x-diff
Expires
Fri, Nov 1, 8:23 AM (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10074957
Default Alt Text
(1 KB)

Event Timeline