Репозитории ALT
5.1: | 3.5.10-alt20.M51.2 |
4.1: | 3.5.10-alt16.M41.1 |
4.0: | 3.5.9-alt1.M40.1 |
3.0: | 3.4.1-alt12 |
+updates: | 3.4.1-alt12.1.M30 |
+backports: | 3.5.6-alt7.0.M30 |
Группа :: Графические оболочки/KDE
Пакет: kdebase
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: kdebase-3.5.0-man_recode.patch
Скачать
Скачать
diff -Naur kdebase-3.5.0-orig/kioslave/man/kio_man.cpp kdebase-3.5.0/kioslave/man/kio_man.cpp
--- kdebase-3.5.0-orig/kioslave/man/kio_man.cpp 2005-10-10 19:04:01 +0400
+++ kdebase-3.5.0/kioslave/man/kio_man.cpp 2006-01-01 19:49:28 +0300
@@ -30,6 +30,8 @@
#include <qptrlist.h>
#include <qmap.h>
#include <qregexp.h>
+#include <qtextcodec.h>
+#include <qfileinfo.h>
#include <kdebug.h>
#include <kinstance.h>
@@ -566,6 +568,51 @@
if (array.isEmpty())
return 0;
+
+ //-------- Make locale encoded manpage text ---------------------------------
+ QTextCodec *loc_codec = QTextCodec::codecForLocale();
+ if (loc_codec) {
+ QTextCodec *man_codec = 0;
+
+ // Try .charmap file in manpage dir
+ QFileInfo fi(QFile::decodeName(_filename));
+ QFile file(fi.dirPath(true).replace(QRegExp("/man\\w$"),"/.charset"));
+
+ if ( file.open( IO_ReadOnly ) ) {
+ QTextStream stream( &file );
+ QString man_charmap;
+
+ man_charmap = stream.readLine(); // line of text excluding '\n'
+ file.close();
+ if (!man_charmap.isEmpty()) {
+ man_codec = QTextCodec::codecForName(man_charmap.latin1());
+ }
+ }
+
+ // Can't find .charmap file or its empty. Try environment
+ // variable
+ if(!man_codec) {
+ char *env = getenv("MAN_ICONV_INPUT_CHARSET");
+ if(env && *env)
+ man_codec = QTextCodec::codecForName(env);
+ }
+
+ // No manpage charmap specified, use UTF-8 as default
+ //if(!man_codec)
+ // man_codec = QTextCodec::codecForMib(106);
+
+ if(man_codec) {
+ if (loc_codec->mibEnum()!=man_codec->mibEnum()) {
+ // Locale has difer charmap than manpage
+ QString unicode;
+
+ kdDebug(7107) << "recode " << man_codec->name() << " to " << loc_codec->name() << endl;
+ unicode = man_codec->toUnicode(array);
+ array = loc_codec->fromUnicode(unicode);
+ }
+ }
+ }
+ //--------------------------------------------------------------------------
const int len = array.size();
buf = new char[len + 4];