- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
// For the probably_koi8_locales we have to look. the standard says
// these are 8859-5, but almost all Russian users use KOI8-R and
// incorrectly set $LANG to ru_RU. We'll check tolower() to see what
// it thinks ru_RU means.
// If you read the history, it seems that many Russians blame ISO and
// Perestroika for the confusion.
...
static QTextCodec * ru_RU_hack(const char * i) {
QTextCodec * ru_RU_codec = 0;
#if !defined(QT_NO_SETLOCALE)
QByteArray origlocale(setlocale(LC_CTYPE, i));
#else
QByteArray origlocale(i);
#endif
// unicode koi8r latin5 name
// 0x044E 0xC0 0xEE CYRILLIC SMALL LETTER YU
// 0x042E 0xE0 0xCE CYRILLIC CAPITAL LETTER YU
int latin5 = tolower(0xCE);
int koi8r = tolower(0xE0);
if (koi8r == 0xC0 && latin5 != 0xEE) {
ru_RU_codec = QTextCodec::codecForName("KOI8-R");
} else if (koi8r != 0xC0 && latin5 == 0xEE) {
ru_RU_codec = QTextCodec::codecForName("ISO 8859-5");
} else {
// something else again... let's assume... *throws dice*
ru_RU_codec = QTextCodec::codecForName("KOI8-R");
qWarning("QTextCodec: Using KOI8-R, probe failed (%02x %02x %s)",
koi8r, latin5, i);
}
#if !defined(QT_NO_SETLOCALE)
setlocale(LC_CTYPE, origlocale);
#endif
return ru_RU_codec;
}
Снова Qt. На этот раз src/corelib/codecs/qtextcodec.cpp и борьба бобра с ослом русских с буржуинскими стандартами ISO.
defecate-plusplus 14.06.2012 09:32 # +2
все руссиан узерс на utf-8 уже сто лет как перешли
vistefan 14.06.2012 09:46 # 0
bormand 14.06.2012 10:06 # 0
geust 14.06.2012 10:14 # +6
Steve_Brown 14.06.2012 11:30 # 0
wvxvw 14.06.2012 12:55 # 0
g0rky 14.06.2012 16:13 # +1