22 #include <kstringhandler.h>
23 #include "kremoteencoding.h"
39 if (codec->mibEnum() == 106 && !KStringHandler::isUtf8(name))
40 return TQString::fromLatin1(name);
43 TQString result = codec->toUnicode(name);
44 if (codec->fromUnicode(result) != name)
46 return TQString::fromLatin1(name);
53 TQCString result = codec->fromUnicode(name);
54 if (codec->toUnicode(result) != name)
67 TQString dir = url.directory(
true, ignore_trailing_slash);
74 return encode(url.fileName());
82 codec = TQTextCodec::codecForName(name);
84 codec = TQTextCodec::codecForMib( 106 );
87 codec = TQTextCodec::codecForMib(1);
89 kdDebug() << k_funcinfo <<
"setting encoding " << codec->name()
90 <<
" for name=" << name << endl;
93 void KRemoteEncoding::virtual_hook(
int,
void*)
void setEncoding(const char *name)
Sets the encoding being used.
TQCString fileName(const KURL &url) const
Converts the given URL into 8-bit form and retrieve the filename.
virtual ~KRemoteEncoding()
Destructor.
TQCString directory(const KURL &url, bool ignore_trailing_slash=true) const
Converts the given URL into 8-bit form and separate the dirname from the filename.
TQCString encode(const TQString &name) const
Converts the given name from Unicode.
KRemoteEncoding(const char *name=0L)
Constructor.
TQString decode(const TQCString &name) const
Converts the given full pathname or filename to Unicode.