|
Packit |
1c1d7e |
/****************************************************************************
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Implementation of QTextCodec class
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Created : 981015
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Copyright (C)1998-2000 Trolltech AS. All rights reserved.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** This file is part of the tools module of the Qt GUI Toolkit.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** This file may be distributed under the terms of the Q Public License
|
|
Packit |
1c1d7e |
** as defined by Trolltech AS of Norway and appearing in the file
|
|
Packit |
1c1d7e |
** LICENSE.QPL included in the packaging of this file.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** This file may be distributed and/or modified under the terms of the
|
|
Packit |
1c1d7e |
** GNU General Public License version 2 as published by the Free Software
|
|
Packit |
1c1d7e |
** Foundation and appearing in the file LICENSE.GPL included in the
|
|
Packit |
1c1d7e |
** packaging of this file.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
|
Packit |
1c1d7e |
** licenses may use this file in accordance with the Qt Commercial License
|
|
Packit |
1c1d7e |
** Agreement provided with the Software.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|
Packit |
1c1d7e |
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
|
Packit |
1c1d7e |
** information about Qt Commercial License Agreements.
|
|
Packit |
1c1d7e |
** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
|
Packit |
1c1d7e |
** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Contact info@trolltech.com if any conditions of this licensing are
|
|
Packit |
1c1d7e |
** not clear to you.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
**********************************************************************/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#include "qtextcodec.h"
|
|
Packit |
1c1d7e |
#ifndef QT_NO_TEXTCODEC
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#include "qinternallist.h"
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CODECS
|
|
Packit |
1c1d7e |
#include "qutfcodec.h"
|
|
Packit |
1c1d7e |
//#include "qgbkcodec.h"
|
|
Packit |
1c1d7e |
//#include "qeucjpcodec.h"
|
|
Packit |
1c1d7e |
//#include "qjiscodec.h"
|
|
Packit |
1c1d7e |
//#include "qsjiscodec.h"
|
|
Packit |
1c1d7e |
//#include "qeuckrcodec.h"
|
|
Packit |
1c1d7e |
//#include "qbig5codec.h"
|
|
Packit |
1c1d7e |
//#include "qrtlcodec.h"
|
|
Packit |
1c1d7e |
//#include "qtsciicodec.h"
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#include "qfile.h"
|
|
Packit |
1c1d7e |
#include "qstrlist.h"
|
|
Packit |
1c1d7e |
#include "qstring.h"
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#include <stdlib.h>
|
|
Packit |
1c1d7e |
#include <ctype.h>
|
|
Packit |
1c1d7e |
#include <locale.h>
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static QInternalList<QTextCodec> * all = 0;
|
|
Packit |
1c1d7e |
static bool destroying_is_ok; // starts out as 0
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*! Deletes all the created codecs.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\warning Do not call this function.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QApplication calls this just before exiting, to delete any
|
|
Packit |
1c1d7e |
QTextCodec objects that may be lying around. Since various other
|
|
Packit |
1c1d7e |
classes hold pointers to QTextCodec objects, it is not safe to call
|
|
Packit |
1c1d7e |
this function earlier.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
If you are using the utility classes (like QString) but not using
|
|
Packit |
1c1d7e |
QApplication, calling this function at the very end of your
|
|
Packit |
1c1d7e |
application can be helpful to chasing down memory leaks, as
|
|
Packit |
1c1d7e |
QTextCodec objects will not show up.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
void QTextCodec::deleteAllCodecs()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( !all )
|
|
Packit |
1c1d7e |
return;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
destroying_is_ok = TRUE;
|
|
Packit |
1c1d7e |
QInternalList<QTextCodec> * ball = all;
|
|
Packit |
1c1d7e |
all = 0;
|
|
Packit |
1c1d7e |
ball->clear();
|
|
Packit |
1c1d7e |
delete ball;
|
|
Packit |
1c1d7e |
destroying_is_ok = FALSE;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static void setupBuiltinCodecs();
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static void realSetup()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
#if defined(CHECK_STATE)
|
|
Packit |
1c1d7e |
if ( destroying_is_ok )
|
|
Packit |
1c1d7e |
qWarning( "creating new codec during codec cleanup" );
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
all = new QInternalList<QTextCodec>;
|
|
Packit |
1c1d7e |
all->setAutoDelete( TRUE );
|
|
Packit |
1c1d7e |
setupBuiltinCodecs();
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static inline void setup()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( !all )
|
|
Packit |
1c1d7e |
realSetup();
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
class QTextStatelessEncoder: public QTextEncoder {
|
|
Packit |
1c1d7e |
const QTextCodec* codec;
|
|
Packit |
1c1d7e |
public:
|
|
Packit |
1c1d7e |
QTextStatelessEncoder(const QTextCodec*);
|
|
Packit |
1c1d7e |
QCString fromUnicode(const QString& uc, int& lenInOut);
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
class QTextStatelessDecoder : public QTextDecoder {
|
|
Packit |
1c1d7e |
const QTextCodec* codec;
|
|
Packit |
1c1d7e |
public:
|
|
Packit |
1c1d7e |
QTextStatelessDecoder(const QTextCodec*);
|
|
Packit |
1c1d7e |
QString toUnicode(const char* chars, int len);
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QTextStatelessEncoder::QTextStatelessEncoder(const QTextCodec* c) :
|
|
Packit |
1c1d7e |
codec(c)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QCString QTextStatelessEncoder::fromUnicode(const QString& uc, int& lenInOut)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return codec->fromUnicode(uc,lenInOut);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QTextStatelessDecoder::QTextStatelessDecoder(const QTextCodec* c) :
|
|
Packit |
1c1d7e |
codec(c)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString QTextStatelessDecoder::toUnicode(const char* chars, int len)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return codec->toUnicode(chars,len);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// NOT REVISED
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
\class QTextCodec qtextcodec.h
|
|
Packit |
1c1d7e |
\brief Provides conversion between text encodings.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
By making objects of subclasses of QTextCodec, support for
|
|
Packit |
1c1d7e |
new text encodings can be added to Qt.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The abstract virtual functions describe the encoder to the
|
|
Packit |
1c1d7e |
system and the coder is used as required in the different
|
|
Packit |
1c1d7e |
text file formats supported QTextStream and, under X11 for the
|
|
Packit |
1c1d7e |
locale-specific character input and output (under Windows NT
|
|
Packit |
1c1d7e |
codecs are not needed for GUI I/O since the system works
|
|
Packit |
1c1d7e |
with Unicode already, and Windows 95/98 has built-in convertors
|
|
Packit |
1c1d7e |
for the 8-bit local encoding).
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
More recently created QTextCodec objects take precedence
|
|
Packit |
1c1d7e |
over earlier ones.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
To add support for another 8-bit encoding to Qt, make a subclass
|
|
Packit |
1c1d7e |
or QTextCodec and implement at least the following methods:
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\c const char* name() const
|
|
Packit |
1c1d7e |
Return the official name for the encoding.
|
|
Packit |
1c1d7e |
\c int mibEnum() const
|
|
Packit |
1c1d7e |
Return the MIB enum for the encoding if it is listed in the
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
IANA character-sets encoding file.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
If the encoding is multi-byte then it will have "state"; that is,
|
|
Packit |
1c1d7e |
the interpretation of some bytes will be dependent on some preceding
|
|
Packit |
1c1d7e |
bytes. For such an encoding, you will need to implement
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\c QTextDecoder* makeDecoder() const
|
|
Packit |
1c1d7e |
Return a QTextDecoder that remembers incomplete multibyte
|
|
Packit |
1c1d7e |
sequence prefixes or other required state.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
If the encoding does \e not require state, you should implement:
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\c QString toUnicode(const char* chars, int len) const
|
|
Packit |
1c1d7e |
Converts \e len characters from \e chars to Unicode.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The base QTextCodec class has default implementations of the above
|
|
Packit |
1c1d7e |
two functions, but they are mutually recursive, so you must
|
|
Packit |
1c1d7e |
re-implement at least one of them, or both for improved efficiency.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
For conversion from Unicode to 8-bit encodings, it is rarely necessary
|
|
Packit |
1c1d7e |
to maintain state. However, two functions similar to the two above
|
|
Packit |
1c1d7e |
are used for encoding:
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\c QTextEncoder* makeEncoder() const
|
|
Packit |
1c1d7e |
Return a QTextDecoder.
|
|
Packit |
1c1d7e |
\c QCString fromUnicode(const QString& uc, int& lenInOut ) const;
|
|
Packit |
1c1d7e |
Converts \e lenInOut characters (of type QChar) from the start
|
|
Packit |
1c1d7e |
of the string \a uc, returning a QCString result, and also returning
|
|
Packit |
1c1d7e |
the \link QCString::length() length\endlink
|
|
Packit |
1c1d7e |
of the result in lenInOut.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Again, these are mutually recursive so only one needs to be implemented,
|
|
Packit |
1c1d7e |
or both if better efficiency is possible.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Finally, you must implement:
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\c int heuristicContentMatch(const char* chars, int len) const
|
|
Packit |
1c1d7e |
Gives a value indicating how likely it is that \e len characters
|
|
Packit |
1c1d7e |
from \e chars are in the encoding.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
A good model for this function is the
|
|
Packit |
1c1d7e |
QWindowsLocalCodec::heuristicContentMatch function found in the Qt sources.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
A QTextCodec subclass might have improved performance if you also
|
|
Packit |
1c1d7e |
re-implement:
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\c bool canEncode( QChar ) const
|
|
Packit |
1c1d7e |
Test if a Unicode character can be encoded.
|
|
Packit |
1c1d7e |
\c bool canEncode( const QString& ) const
|
|
Packit |
1c1d7e |
Test if a string of Unicode characters can be encoded.
|
|
Packit |
1c1d7e |
\c int heuristicNameMatch(const char* hint) const
|
|
Packit |
1c1d7e |
Test if a possibly non-standard name is referring to the codec.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Constructs a QTextCodec, making it of highest precedence.
|
|
Packit |
1c1d7e |
The QTextCodec should always be constructed on the heap
|
|
Packit |
1c1d7e |
(with new), and once constructed it becomes the responsibility
|
|
Packit |
1c1d7e |
of Qt to delete it (which is done at QApplication destruction).
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QTextCodec::QTextCodec()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
setup();
|
|
Packit |
1c1d7e |
all->insert(0,this);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Destructs the QTextCodec. Note that you should not delete
|
|
Packit |
1c1d7e |
codecs yourself - once created they become the responsibility
|
|
Packit |
1c1d7e |
of Qt to delete.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QTextCodec::~QTextCodec()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( !destroying_is_ok )
|
|
Packit |
1c1d7e |
qWarning("QTextCodec::~QTextCodec() called by application");
|
|
Packit |
1c1d7e |
if ( all )
|
|
Packit |
1c1d7e |
all->remove( this );
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Returns a value indicating how likely this decoder is
|
|
Packit |
1c1d7e |
for decoding some format that has the given name.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
A good match returns a positive number around
|
|
Packit |
1c1d7e |
the length of the string. A bad match is negative.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The default implementation calls simpleHeuristicNameMatch()
|
|
Packit |
1c1d7e |
with the name of the codec.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
int QTextCodec::heuristicNameMatch(const char* hint) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return simpleHeuristicNameMatch(name(),hint);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// returns a string cotnaining the letters and numbers from input,
|
|
Packit |
1c1d7e |
// with a space separating run of a character class. e.g. "iso8859-1"
|
|
Packit |
1c1d7e |
// becomes "iso 8859 1"
|
|
Packit |
1c1d7e |
static QString lettersAndNumbers( const char * input )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QString result;
|
|
Packit |
1c1d7e |
QChar c;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
while( input && *input ) {
|
|
Packit |
1c1d7e |
c = *input;
|
|
Packit |
1c1d7e |
if ( c.isLetter() || c.isNumber() )
|
|
Packit |
1c1d7e |
result += c.lower();
|
|
Packit |
1c1d7e |
if ( input[1] ) {
|
|
Packit |
1c1d7e |
// add space at character class transition, except
|
|
Packit |
1c1d7e |
// transition from upper-case to lower-case letter
|
|
Packit |
1c1d7e |
QChar n( input[1] );
|
|
Packit |
1c1d7e |
if ( c.isLetter() && n.isLetter() ) {
|
|
Packit |
1c1d7e |
if ( c == c.lower() && n == n.upper() )
|
|
Packit |
1c1d7e |
result += ' ';
|
|
Packit |
1c1d7e |
} else if ( c.category() != n.category() ) {
|
|
Packit |
1c1d7e |
result += ' ';
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
input++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return result.simplifyWhiteSpace();
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
A simple utility function for heuristicNameMatch() - it
|
|
Packit |
1c1d7e |
does some very minor character-skipping
|
|
Packit |
1c1d7e |
so that almost-exact matches score high.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
int QTextCodec::simpleHeuristicNameMatch(const char* name, const char* hint)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
// if they're the same, return a perfect score.
|
|
Packit |
1c1d7e |
if ( name && hint && qstrcmp( name, hint ) == 0 )
|
|
Packit |
1c1d7e |
return qstrlen( hint );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// if the letters and numbers are the same, we have an "almost"
|
|
Packit |
1c1d7e |
// perfect match.
|
|
Packit |
1c1d7e |
QString h( lettersAndNumbers( hint ) );
|
|
Packit |
1c1d7e |
QString n( lettersAndNumbers( name ) );
|
|
Packit |
1c1d7e |
if ( h == n )
|
|
Packit |
1c1d7e |
return qstrlen( hint )-1;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
if ( h.stripWhiteSpace() == n.stripWhiteSpace() )
|
|
Packit |
1c1d7e |
return qstrlen( hint )-2;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// could do some more here, but I don't think it's worth it
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
return 0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Returns the QTextCodec \a i places from the more recently
|
|
Packit |
1c1d7e |
inserted, or NULL if there is no such QTextCodec. Thus,
|
|
Packit |
1c1d7e |
codecForIndex(0) returns the most recently created QTextCodec.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QTextCodec* QTextCodec::codecForIndex(int i)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
setup();
|
|
Packit |
1c1d7e |
return (uint)i >= all->count() ? 0 : all->at(i);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Returns the QTextCodec which matches the
|
|
Packit |
1c1d7e |
\link QTextCodec::mibEnum() MIBenum\endlink \a mib.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QTextCodec* QTextCodec::codecForMib(int mib)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
setup();
|
|
Packit |
1c1d7e |
QInternalListIterator<QTextCodec> i(*all);
|
|
Packit |
1c1d7e |
QTextCodec* result;
|
|
Packit |
1c1d7e |
for ( ; (result=i); ++i ) {
|
|
Packit |
1c1d7e |
if ( result->mibEnum()==mib )
|
|
Packit |
1c1d7e |
break;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return result;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifdef _OS_WIN32_
|
|
Packit |
1c1d7e |
class QWindowsLocalCodec: public QTextCodec
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
public:
|
|
Packit |
1c1d7e |
QWindowsLocalCodec();
|
|
Packit |
1c1d7e |
~QWindowsLocalCodec();
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString toUnicode(const char* chars, int len) const;
|
|
Packit |
1c1d7e |
QCString fromUnicode(const QString& uc, int& lenInOut ) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
const char* name() const;
|
|
Packit |
1c1d7e |
int mibEnum() const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int heuristicContentMatch(const char* chars, int len) const;
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QWindowsLocalCodec::QWindowsLocalCodec()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QWindowsLocalCodec::~QWindowsLocalCodec()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString QWindowsLocalCodec::toUnicode(const char* chars, int len) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( len == 1 && chars ) { // Optimization; avoids allocation
|
|
Packit |
1c1d7e |
char c[2];
|
|
Packit |
1c1d7e |
c[0] = *chars;
|
|
Packit |
1c1d7e |
c[1] = 0;
|
|
Packit |
1c1d7e |
return qt_winMB2QString( c, 2 );
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if ( len < 0 )
|
|
Packit |
1c1d7e |
return qt_winMB2QString( chars );
|
|
Packit |
1c1d7e |
QCString s(chars,len+1);
|
|
Packit |
1c1d7e |
return qt_winMB2QString(s);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QCString QWindowsLocalCodec::fromUnicode(const QString& uc, int& lenInOut ) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QCString r = qt_winQString2MB( uc, lenInOut );
|
|
Packit |
1c1d7e |
lenInOut = r.length();
|
|
Packit |
1c1d7e |
return r;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
const char* QWindowsLocalCodec::name() const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return "System";
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int QWindowsLocalCodec::mibEnum() const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return 0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int QWindowsLocalCodec::heuristicContentMatch(const char* chars, int len) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
// ### Not a bad default implementation?
|
|
Packit |
1c1d7e |
QString t = toUnicode(chars,len);
|
|
Packit |
1c1d7e |
int l = t.length();
|
|
Packit |
1c1d7e |
QCString mb = fromUnicode(t,l);
|
|
Packit |
1c1d7e |
int i=0;
|
|
Packit |
1c1d7e |
while ( i < len )
|
|
Packit |
1c1d7e |
if ( chars[i] == mb[i] )
|
|
Packit |
1c1d7e |
i++;
|
|
Packit |
1c1d7e |
return i;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#else
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/* locale names mostly copied from XFree86 */
|
|
Packit |
1c1d7e |
static const char * const iso8859_2locales[] = {
|
|
Packit |
1c1d7e |
"croatian", "cs", "cs_CS", "cs_CZ","cz", "cz_CZ", "czech", "hr",
|
|
Packit |
1c1d7e |
"hr_HR", "hu", "hu_HU", "hungarian", "pl", "pl_PL", "polish", "ro",
|
|
Packit |
1c1d7e |
"ro_RO", "rumanian", "serbocroatian", "sh", "sh_SP", "sh_YU", "sk",
|
|
Packit |
1c1d7e |
"sk_SK", "sl", "sl_CS", "sl_SI", "slovak", "slovene", "sr_SP", 0 };
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static const char * const iso8859_3locales[] = {
|
|
Packit |
1c1d7e |
"eo", 0 };
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static const char * const iso8859_4locales[] = {
|
|
Packit |
1c1d7e |
"ee", "ee_EE", "lt", "lt_LT", "lv", "lv_LV", 0 };
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static const char * const iso8859_5locales[] = {
|
|
Packit |
1c1d7e |
"bg", "bg_BG", "bulgarian", "mk", "mk_MK",
|
|
Packit |
1c1d7e |
"sp", "sp_YU", 0 };
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static const char * const iso8859_6locales[] = {
|
|
Packit |
1c1d7e |
"ar_AA", "ar_SA", "arabic", 0 };
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static const char * const iso8859_7locales[] = {
|
|
Packit |
1c1d7e |
"el", "el_GR", "greek", 0 };
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static const char * const iso8859_8locales[] = {
|
|
Packit |
1c1d7e |
"hebrew", "he", "he_IL", "iw", "iw_IL", 0 };
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static const char * const iso8859_9locales[] = {
|
|
Packit |
1c1d7e |
"tr", "tr_TR", "turkish", 0 };
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static const char * const iso8859_15locales[] = {
|
|
Packit |
1c1d7e |
"fr", "fi", "french", "finnish", "et", "et_EE", 0 };
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static const char * const koi8_ulocales[] = {
|
|
Packit |
1c1d7e |
"uk", "uk_UA", "ru_UA", "ukrainian", 0 };
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static const char * const tis_620locales[] = {
|
|
Packit |
1c1d7e |
"th", "th_TH", "thai", 0 };
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static bool try_locale_list( const char * const locale[], const char * lang )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
int i;
|
|
Packit |
1c1d7e |
for( i=0; locale[i] && qstrcmp(locale[i], lang); i++ )
|
|
Packit |
1c1d7e |
{ }
|
|
Packit |
1c1d7e |
return locale[i] != 0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// For the probably_koi8_locales we have to look. the standard says
|
|
Packit |
1c1d7e |
// these are 8859-5, but almost all Russian users uses KOI8-R and
|
|
Packit |
1c1d7e |
// incorrectly set $LANG to ru_RU. We'll check tolower() to see what
|
|
Packit |
1c1d7e |
// tolower() thinks ru_RU means.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// If you read the history, it seems that many Russians blame ISO and
|
|
Packit |
1c1d7e |
// Peristroika for the confusion.
|
|
Packit |
1c1d7e |
//
|
|
Packit |
1c1d7e |
// The real bug is that some programs break if the user specifies
|
|
Packit |
1c1d7e |
// ru_RU.KOI8-R.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static const char * const probably_koi8_rlocales[] = {
|
|
Packit |
1c1d7e |
"ru", "ru_SU", "ru_RU", "russian", 0 };
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// this means ANY of these locale aliases. if they're aliases for
|
|
Packit |
1c1d7e |
// different locales, the code breaks.
|
|
Packit |
1c1d7e |
static QTextCodec * ru_RU_codec = 0;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static QTextCodec * ru_RU_hack( const char * i ) {
|
|
Packit |
1c1d7e |
if ( ! ru_RU_codec ) {
|
|
Packit |
1c1d7e |
QCString origlocale = setlocale( LC_CTYPE, i );
|
|
Packit |
1c1d7e |
// unicode koi8r latin5 name
|
|
Packit |
1c1d7e |
// 0x044E 0xC0 0xEE CYRILLIC SMALL LETTER YU
|
|
Packit |
1c1d7e |
// 0x042E 0xE0 0xCE CYRILLIC CAPITAL LETTER YU
|
|
Packit |
1c1d7e |
int latin5 = tolower( 0xCE );
|
|
Packit |
1c1d7e |
int koi8r = tolower( 0xE0 );
|
|
Packit |
1c1d7e |
if ( koi8r == 0xC0 && latin5 != 0xEE ) {
|
|
Packit |
1c1d7e |
ru_RU_codec = QTextCodec::codecForName( "KOI8-R" );
|
|
Packit |
1c1d7e |
} else if ( koi8r != 0xC0 && latin5 == 0xEE ) {
|
|
Packit |
1c1d7e |
ru_RU_codec = QTextCodec::codecForName( "ISO 8859-5" );
|
|
Packit |
1c1d7e |
} else {
|
|
Packit |
1c1d7e |
// something else again... let's assume... *throws dice*
|
|
Packit |
1c1d7e |
ru_RU_codec = QTextCodec::codecForName( "KOI8-R" );
|
|
Packit |
1c1d7e |
qWarning( "QTextCodec: using KOI8-R, probe failed (%02x %02x %s)",
|
|
Packit |
1c1d7e |
koi8r, latin5, i );
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
setlocale( LC_CTYPE, origlocale.data() );
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return ru_RU_codec;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static QTextCodec * localeMapper = 0;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
void qt_set_locale_codec( QTextCodec *codec )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
localeMapper = codec;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*! Returns a pointer to the codec most suitable for this locale. */
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QTextCodec* QTextCodec::codecForLocale()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( localeMapper )
|
|
Packit |
1c1d7e |
return localeMapper;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
setup();
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifdef _OS_WIN32_
|
|
Packit |
1c1d7e |
localeMapper = new QWindowsLocalCodec;
|
|
Packit |
1c1d7e |
#else
|
|
Packit |
1c1d7e |
// Very poorly defined and followed standards causes lots of code
|
|
Packit |
1c1d7e |
// to try to get all the cases...
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
char * lang = qstrdup( getenv("LANG") );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
char * p = lang ? strchr( lang, '.' ) : 0;
|
|
Packit |
1c1d7e |
if ( !p || *p != '.' ) {
|
|
Packit |
1c1d7e |
// Some versions of setlocale return encoding, others not.
|
|
Packit |
1c1d7e |
char *ctype = qstrdup( setlocale( LC_CTYPE, 0 ) );
|
|
Packit |
1c1d7e |
// Some Linux distributions have broken locales which will return
|
|
Packit |
1c1d7e |
// "C" for LC_CTYPE
|
|
Packit |
1c1d7e |
if ( qstrcmp( ctype, "C" ) == 0 ) {
|
|
Packit |
1c1d7e |
delete [] ctype;
|
|
Packit |
1c1d7e |
} else {
|
|
Packit |
1c1d7e |
if ( lang )
|
|
Packit |
1c1d7e |
delete [] lang;
|
|
Packit |
1c1d7e |
lang = ctype;
|
|
Packit |
1c1d7e |
p = lang ? strchr( lang, '.' ) : 0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
if( p && *p == '.' ) {
|
|
Packit |
1c1d7e |
// if there is an encoding and we don't know it, we return 0
|
|
Packit |
1c1d7e |
// User knows what they are doing. Codecs will believe them.
|
|
Packit |
1c1d7e |
localeMapper = codecForName( lang );
|
|
Packit |
1c1d7e |
if ( !localeMapper ) {
|
|
Packit |
1c1d7e |
// Use or codec disagree.
|
|
Packit |
1c1d7e |
localeMapper = codecForName( p+1 );
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if ( !localeMapper || !(p && *p == '.') ) {
|
|
Packit |
1c1d7e |
// if there is none, we default to 8859-1
|
|
Packit |
1c1d7e |
// We could perhaps default to 8859-15.
|
|
Packit |
1c1d7e |
if ( try_locale_list( iso8859_2locales, lang ) )
|
|
Packit |
1c1d7e |
localeMapper = codecForName( "ISO 8859-2" );
|
|
Packit |
1c1d7e |
else if ( try_locale_list( iso8859_3locales, lang ) )
|
|
Packit |
1c1d7e |
localeMapper = codecForName( "ISO 8859-3" );
|
|
Packit |
1c1d7e |
else if ( try_locale_list( iso8859_4locales, lang ) )
|
|
Packit |
1c1d7e |
localeMapper = codecForName( "ISO 8859-4" );
|
|
Packit |
1c1d7e |
else if ( try_locale_list( iso8859_5locales, lang ) )
|
|
Packit |
1c1d7e |
localeMapper = codecForName( "ISO 8859-5" );
|
|
Packit |
1c1d7e |
else if ( try_locale_list( iso8859_6locales, lang ) )
|
|
Packit |
1c1d7e |
localeMapper = codecForName( "ISO 8859-6-I" );
|
|
Packit |
1c1d7e |
else if ( try_locale_list( iso8859_7locales, lang ) )
|
|
Packit |
1c1d7e |
localeMapper = codecForName( "ISO 8859-7" );
|
|
Packit |
1c1d7e |
else if ( try_locale_list( iso8859_8locales, lang ) )
|
|
Packit |
1c1d7e |
localeMapper = codecForName( "ISO 8859-8-I" );
|
|
Packit |
1c1d7e |
else if ( try_locale_list( iso8859_9locales, lang ) )
|
|
Packit |
1c1d7e |
localeMapper = codecForName( "ISO 8859-9" );
|
|
Packit |
1c1d7e |
else if ( try_locale_list( iso8859_15locales, lang ) )
|
|
Packit |
1c1d7e |
localeMapper = codecForName( "ISO 8859-15" );
|
|
Packit |
1c1d7e |
else if ( try_locale_list( tis_620locales, lang ) )
|
|
Packit |
1c1d7e |
localeMapper = codecForName( "ISO 8859-11" );
|
|
Packit |
1c1d7e |
else if ( try_locale_list( koi8_ulocales, lang ) )
|
|
Packit |
1c1d7e |
localeMapper = codecForName( "KOI8-U" );
|
|
Packit |
1c1d7e |
else if ( try_locale_list( probably_koi8_rlocales, lang ) )
|
|
Packit |
1c1d7e |
localeMapper = ru_RU_hack( lang );
|
|
Packit |
1c1d7e |
else if (!lang || !(localeMapper = codecForName(lang) ))
|
|
Packit |
1c1d7e |
localeMapper = codecForName( "ISO 8859-1" );
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
delete[] lang;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
return localeMapper;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Searches all installed QTextCodec objects, returning the one
|
|
Packit |
1c1d7e |
which best matches given name. Returns NULL if no codec has
|
|
Packit |
1c1d7e |
a match closeness above \a accuracy.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\sa heuristicNameMatch()
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QTextCodec* QTextCodec::codecForName(const char* hint, int accuracy)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
setup();
|
|
Packit |
1c1d7e |
QInternalListIterator<QTextCodec> i(*all);
|
|
Packit |
1c1d7e |
QTextCodec* result = 0;
|
|
Packit |
1c1d7e |
int best=accuracy;
|
|
Packit |
1c1d7e |
for ( QTextCodec* cursor; (cursor=i); ++i ) {
|
|
Packit |
1c1d7e |
int s = cursor->heuristicNameMatch(hint);
|
|
Packit |
1c1d7e |
if ( s > best ) {
|
|
Packit |
1c1d7e |
best = s;
|
|
Packit |
1c1d7e |
result = cursor;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return result;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Searches all installed QTextCodec objects, returning the one
|
|
Packit |
1c1d7e |
which most recognizes the given content. May return 0.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Note that this is often a poor choice, since character
|
|
Packit |
1c1d7e |
encodings often use most of the available character sequences,
|
|
Packit |
1c1d7e |
and so only by linguistic analysis could a true match be made.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\sa heuristicContentMatch()
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QTextCodec* QTextCodec::codecForContent(const char* chars, int len)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
setup();
|
|
Packit |
1c1d7e |
QInternalListIterator<QTextCodec> i(*all);
|
|
Packit |
1c1d7e |
QTextCodec* result = 0;
|
|
Packit |
1c1d7e |
int best=0;
|
|
Packit |
1c1d7e |
for ( QTextCodec* cursor; (cursor=i); ++i ) {
|
|
Packit |
1c1d7e |
int s = cursor->heuristicContentMatch(chars,len);
|
|
Packit |
1c1d7e |
if ( s > best ) {
|
|
Packit |
1c1d7e |
best = s;
|
|
Packit |
1c1d7e |
result = cursor;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return result;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
\fn const char* QTextCodec::name() const
|
|
Packit |
1c1d7e |
Subclasses of QTextCodec must reimplement this function. It returns
|
|
Packit |
1c1d7e |
the name of the encoding supported by the subclass. When choosing
|
|
Packit |
1c1d7e |
a name for an encoding, consider these points:
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
On X11, heuristicNameMatch( const char * hint )
|
|
Packit |
1c1d7e |
is used to test if a the QTextCodec
|
|
Packit |
1c1d7e |
can convert between Unicode and the encoding of a font
|
|
Packit |
1c1d7e |
with encoding \e hint, such as "iso8859-1" for Latin-1 fonts,
|
|
Packit |
1c1d7e |
"koi8-r" for Russian KOI8 fonts.
|
|
Packit |
1c1d7e |
The default algorithm of heuristicNameMatch() uses name().
|
|
Packit |
1c1d7e |
Some applications may use this function to present
|
|
Packit |
1c1d7e |
encodings to the end user.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
\fn int QTextCodec::mibEnum() const
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Subclasses of QTextCodec must reimplement this function. It returns the
|
|
Packit |
1c1d7e |
MIBenum (see
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
the IANA character-sets encoding file for more information).
|
|
Packit |
1c1d7e |
It is important that each QTextCodec subclass return the correct unique
|
|
Packit |
1c1d7e |
value for this function.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
\fn int QTextCodec::heuristicContentMatch(const char* chars, int len) const
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Subclasses of QTextCodec must reimplement this function. It examines
|
|
Packit |
1c1d7e |
the first \a len bytes of \a chars and returns a value indicating how
|
|
Packit |
1c1d7e |
likely it is that the string is a prefix of text encoded in the
|
|
Packit |
1c1d7e |
encoding of the subclass. Any negative return value indicates that the text
|
|
Packit |
1c1d7e |
is detectably not in the encoding (eg. it contains undefined characters).
|
|
Packit |
1c1d7e |
A return value of 0 indicates that the text should be decoded with this
|
|
Packit |
1c1d7e |
codec rather than as ASCII, but there
|
|
Packit |
1c1d7e |
is no particular evidence. The value should range up to \a len. Thus,
|
|
Packit |
1c1d7e |
most decoders will return -1, 0, or -\a len.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The characters are not null terminated.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\sa codecForContent().
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Creates a QTextDecoder which stores enough state to decode chunks
|
|
Packit |
1c1d7e |
of char* data to create chunks of Unicode data. The default implementation
|
|
Packit |
1c1d7e |
creates a stateless decoder, which is sufficient for only the simplest
|
|
Packit |
1c1d7e |
encodings where each byte corresponds to exactly one Unicode character.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The caller is responsible for deleting the returned object.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QTextDecoder* QTextCodec::makeDecoder() const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return new QTextStatelessDecoder(this);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Creates a QTextEncoder which stores enough state to encode chunks
|
|
Packit |
1c1d7e |
of Unicode data as char* data. The default implementation
|
|
Packit |
1c1d7e |
creates a stateless encoder, which is sufficient for only the simplest
|
|
Packit |
1c1d7e |
encodings where each Unicode character corresponds to exactly one char.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The caller is responsible for deleting the returned object.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QTextEncoder* QTextCodec::makeEncoder() const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return new QTextStatelessEncoder(this);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Subclasses of QTextCodec must reimplement this function or
|
|
Packit |
1c1d7e |
makeDecoder(). It converts the first \a len characters of \a chars
|
|
Packit |
1c1d7e |
to Unicode.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The default implementation makes a decoder with makeDecoder() and
|
|
Packit |
1c1d7e |
converts the input with that. Note that the default makeDecoder()
|
|
Packit |
1c1d7e |
implementation makes a decoder that simply calls
|
|
Packit |
1c1d7e |
this function, hence subclasses \e must reimplement one function or
|
|
Packit |
1c1d7e |
the other to avoid infinite recursion.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QString QTextCodec::toUnicode(const char* chars, int len) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QTextDecoder* i = makeDecoder();
|
|
Packit |
1c1d7e |
QString result = i->toUnicode(chars,len);
|
|
Packit |
1c1d7e |
delete i;
|
|
Packit |
1c1d7e |
return result;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Subclasses of QTextCodec must reimplement either this function or
|
|
Packit |
1c1d7e |
makeEncoder(). It converts the first \a lenInOut characters of \a
|
|
Packit |
1c1d7e |
uc from Unicode to the encoding of the subclass. If \a lenInOut
|
|
Packit |
1c1d7e |
is negative or too large, the length of \a uc is used instead.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The value returned is the property of the caller, which is
|
|
Packit |
1c1d7e |
responsible for deleting it with "delete []". The length of the
|
|
Packit |
1c1d7e |
resulting Unicode character sequence is returned in \a lenInOut.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The default implementation makes an encoder with makeEncoder() and
|
|
Packit |
1c1d7e |
converts the input with that. Note that the default makeEncoder()
|
|
Packit |
1c1d7e |
implementation makes an encoder that simply calls
|
|
Packit |
1c1d7e |
this function, hence subclasses \e must reimplement one function or
|
|
Packit |
1c1d7e |
the other to avoid infinite recursion.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QCString QTextCodec::fromUnicode(const QString& uc, int& lenInOut) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QTextEncoder* i = makeEncoder();
|
|
Packit |
1c1d7e |
QCString result = i->fromUnicode(uc, lenInOut);
|
|
Packit |
1c1d7e |
delete i;
|
|
Packit |
1c1d7e |
return result;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
\overload QCString QTextCodec::fromUnicode(const QString& uc) const
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QCString QTextCodec::fromUnicode(const QString& uc) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
int l = uc.length();
|
|
Packit |
1c1d7e |
return fromUnicode(uc,l);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
\overload QString QTextCodec::toUnicode(const QByteArray& a, int len) const
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QString QTextCodec::toUnicode(const QByteArray& a, int len) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
int l = a.size();
|
|
Packit |
1c1d7e |
if( l > 0 && a.data()[l - 1] == '\0' ) l--;
|
|
Packit |
1c1d7e |
l = QMIN( l, len );
|
|
Packit |
1c1d7e |
return toUnicode( a.data(), l );
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
\overload QString QTextCodec::toUnicode(const QByteArray& a) const
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QString QTextCodec::toUnicode(const QByteArray& a) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
int l = a.size();
|
|
Packit |
1c1d7e |
if( l > 0 && a.data()[l - 1] == '\0' ) l--;
|
|
Packit |
1c1d7e |
return toUnicode( a.data(), l );
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
\overload QString QTextCodec::toUnicode(const char* chars) const
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QString QTextCodec::toUnicode(const char* chars) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return toUnicode(chars,qstrlen(chars));
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Returns TRUE if the unicode character \a ch can be fully encoded
|
|
Packit |
1c1d7e |
with this codec. The default implementation tests if the result of
|
|
Packit |
1c1d7e |
toUnicode(fromUnicode(ch)) is the original \a ch. Subclasses may be
|
|
Packit |
1c1d7e |
able to improve the efficiency.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
bool QTextCodec::canEncode( QChar ch ) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return toUnicode(fromUnicode(ch)) == ch;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Returns TRUE if the unicode string \a s can be fully encoded
|
|
Packit |
1c1d7e |
with this codec. The default implementation tests if the result of
|
|
Packit |
1c1d7e |
toUnicode(fromUnicode(s)) is the original \a s. Subclasses may be
|
|
Packit |
1c1d7e |
able to improve the efficiency.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
bool QTextCodec::canEncode( const QString& s ) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return toUnicode(fromUnicode(s)) == s;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
\class QTextEncoder qtextcodec.h
|
|
Packit |
1c1d7e |
\brief State-based encoder
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
A QTextEncoder converts Unicode into another format, remembering
|
|
Packit |
1c1d7e |
any state that is required between calls.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\sa QTextCodec::makeEncoder()
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Destructs the encoder.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QTextEncoder::~QTextEncoder()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
\fn QCString QTextEncoder::fromUnicode(const QString& uc, int& lenInOut)
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Converts \a lenInOut characters (not bytes) from \a uc, producing
|
|
Packit |
1c1d7e |
a QCString. \a lenInOut will also be set to the
|
|
Packit |
1c1d7e |
\link QCString::length() length\endlink of the result (in bytes).
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The encoder is free to record state to use when subsequent calls are
|
|
Packit |
1c1d7e |
made to this function (for example, it might change modes with escape
|
|
Packit |
1c1d7e |
sequences if needed during the encoding of one string, then assume that
|
|
Packit |
1c1d7e |
mode applies when a subsequent call begins).
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
\class QTextDecoder qtextcodec.h
|
|
Packit |
1c1d7e |
\brief State-based decoder
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
A QTextEncoder converts a text format into Unicode, remembering
|
|
Packit |
1c1d7e |
any state that is required between calls.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\sa QTextCodec::makeEncoder()
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Destructs the decoder.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QTextDecoder::~QTextDecoder()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
\fn QString QTextDecoder::toUnicode(const char* chars, int len)
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Converts the first \a len bytes at \a chars to Unicode, returning the
|
|
Packit |
1c1d7e |
result.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
If not all characters are used (eg. only part of a multi-byte
|
|
Packit |
1c1d7e |
encoding is at the end of the characters), the decoder remembers
|
|
Packit |
1c1d7e |
enough state to continue with the next call to this function.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#define CHAINED 0xffff
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
struct QMultiByteUnicodeTable {
|
|
Packit |
1c1d7e |
// If multibyte, ignore unicode and index into multibyte
|
|
Packit |
1c1d7e |
// with the next character.
|
|
Packit |
1c1d7e |
QMultiByteUnicodeTable() : unicode(0xfffd), multibyte(0) { }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
~QMultiByteUnicodeTable()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( multibyte )
|
|
Packit |
1c1d7e |
delete [] multibyte;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
ushort unicode;
|
|
Packit |
1c1d7e |
QMultiByteUnicodeTable* multibyte;
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CODECS
|
|
Packit |
1c1d7e |
static int getByte(char* &cursor)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
int byte = 0;
|
|
Packit |
1c1d7e |
if ( *cursor ) {
|
|
Packit |
1c1d7e |
if ( cursor[1] == 'x' )
|
|
Packit |
1c1d7e |
byte = (int)strtol(cursor+2,&cursor,16);
|
|
Packit |
1c1d7e |
else if ( cursor[1] == 'd' )
|
|
Packit |
1c1d7e |
byte = (int)strtol(cursor+2,&cursor,10);
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
byte = (int)strtol(cursor+2,&cursor,8);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return byte&0xff;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
class QTextCodecFromIOD;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
class QTextCodecFromIODDecoder : public QTextDecoder {
|
|
Packit |
1c1d7e |
const QTextCodecFromIOD* codec;
|
|
Packit |
1c1d7e |
QMultiByteUnicodeTable* mb;
|
|
Packit |
1c1d7e |
public:
|
|
Packit |
1c1d7e |
QTextCodecFromIODDecoder(const QTextCodecFromIOD* c);
|
|
Packit |
1c1d7e |
QString toUnicode(const char* chars, int len);
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
class QTextCodecFromIOD : public QTextCodec {
|
|
Packit |
1c1d7e |
friend class QTextCodecFromIODDecoder;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QCString n;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// If from_unicode_page[row()][cell()] is 0 and from_unicode_page_multibyte,
|
|
Packit |
1c1d7e |
// use from_unicode_page_multibyte[row()][cell()] as string.
|
|
Packit |
1c1d7e |
char** from_unicode_page;
|
|
Packit |
1c1d7e |
char*** from_unicode_page_multibyte;
|
|
Packit |
1c1d7e |
char unkn;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// Only one of these is used
|
|
Packit |
1c1d7e |
ushort* to_unicode;
|
|
Packit |
1c1d7e |
QMultiByteUnicodeTable* to_unicode_multibyte;
|
|
Packit |
1c1d7e |
int max_bytes_per_char;
|
|
Packit |
1c1d7e |
QStrList aliases;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
bool stateless() const { return !to_unicode_multibyte; }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
public:
|
|
Packit |
1c1d7e |
QTextCodecFromIOD(QIODevice* iod)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
from_unicode_page = 0;
|
|
Packit |
1c1d7e |
to_unicode_multibyte = 0;
|
|
Packit |
1c1d7e |
to_unicode = 0;
|
|
Packit |
1c1d7e |
from_unicode_page_multibyte = 0;
|
|
Packit |
1c1d7e |
max_bytes_per_char = 1;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
const int maxlen=100;
|
|
Packit |
1c1d7e |
char line[maxlen];
|
|
Packit |
1c1d7e |
char esc='\\';
|
|
Packit |
1c1d7e |
char comm='%';
|
|
Packit |
1c1d7e |
bool incmap = FALSE;
|
|
Packit |
1c1d7e |
while (iod->readLine(line,maxlen) > 0) {
|
|
Packit |
1c1d7e |
if (0==qstrnicmp(line,"<code_set_name>",15))
|
|
Packit |
1c1d7e |
n = line+15;
|
|
Packit |
1c1d7e |
else if (0==qstrnicmp(line,"<escape_char> ",14))
|
|
Packit |
1c1d7e |
esc = line[14];
|
|
Packit |
1c1d7e |
else if (0==qstrnicmp(line,"<comment_char> ",15))
|
|
Packit |
1c1d7e |
comm = line[15];
|
|
Packit |
1c1d7e |
else if (line[0]==comm && 0==qstrnicmp(line+1," alias ",7)) {
|
|
Packit |
1c1d7e |
aliases.append(line+8);
|
|
Packit |
1c1d7e |
} else if (0==qstrnicmp(line,"CHARMAP",7)) {
|
|
Packit |
1c1d7e |
if (!from_unicode_page) {
|
|
Packit |
1c1d7e |
from_unicode_page = new char*[256];
|
|
Packit |
1c1d7e |
for (int i=0; i<256; i++)
|
|
Packit |
1c1d7e |
from_unicode_page[i]=0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if (!to_unicode) {
|
|
Packit |
1c1d7e |
to_unicode = new ushort[256];
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
incmap = TRUE;
|
|
Packit |
1c1d7e |
} else if (0==qstrnicmp(line,"END CHARMAP",11))
|
|
Packit |
1c1d7e |
break;
|
|
Packit |
1c1d7e |
else if (incmap) {
|
|
Packit |
1c1d7e |
char* cursor = line;
|
|
Packit |
1c1d7e |
int byte=0,unicode=-1;
|
|
Packit |
1c1d7e |
ushort* mb_unicode=0;
|
|
Packit |
1c1d7e |
const int maxmb=8; // more -> we'll need to improve datastructures
|
|
Packit |
1c1d7e |
char mb[maxmb+1];
|
|
Packit |
1c1d7e |
int nmb=0;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
while (*cursor) {
|
|
Packit |
1c1d7e |
if (cursor[0]=='<' && cursor[1]=='U' &&
|
|
Packit |
1c1d7e |
cursor[2]>='0' && cursor[2]<='9' &&
|
|
Packit |
1c1d7e |
cursor[3]>='0' && cursor[3]<='9') {
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
unicode = (int)strtol(cursor+2,&cursor,16);
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
} else if (*cursor==esc) {
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
byte = getByte(cursor);
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
if ( *cursor == esc ) {
|
|
Packit |
1c1d7e |
if ( !to_unicode_multibyte ) {
|
|
Packit |
1c1d7e |
to_unicode_multibyte =
|
|
Packit |
1c1d7e |
new QMultiByteUnicodeTable[256];
|
|
Packit |
1c1d7e |
for (int i=0; i<256; i++) {
|
|
Packit |
1c1d7e |
to_unicode_multibyte[i].unicode =
|
|
Packit |
1c1d7e |
to_unicode[i];
|
|
Packit |
1c1d7e |
to_unicode_multibyte[i].multibyte = 0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
delete [] to_unicode;
|
|
Packit |
1c1d7e |
to_unicode = 0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
QMultiByteUnicodeTable* mbut =
|
|
Packit |
1c1d7e |
to_unicode_multibyte+byte;
|
|
Packit |
1c1d7e |
mb[nmb++] = byte;
|
|
Packit |
1c1d7e |
while ( nmb < maxmb && *cursor == esc ) {
|
|
Packit |
1c1d7e |
// Always at least once
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
mbut->unicode = CHAINED;
|
|
Packit |
1c1d7e |
byte = getByte(cursor);
|
|
Packit |
1c1d7e |
mb[nmb++] = byte;
|
|
Packit |
1c1d7e |
if (!mbut->multibyte) {
|
|
Packit |
1c1d7e |
mbut->multibyte =
|
|
Packit |
1c1d7e |
new QMultiByteUnicodeTable[256];
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
mbut = mbut->multibyte+byte;
|
|
Packit |
1c1d7e |
mb_unicode = & mbut->unicode;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
if ( nmb > max_bytes_per_char )
|
|
Packit |
1c1d7e |
max_bytes_per_char = nmb;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
} else {
|
|
Packit |
1c1d7e |
cursor++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
if (unicode >= 0 && unicode <= 0xffff)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QChar ch((ushort)unicode);
|
|
Packit |
1c1d7e |
if (!from_unicode_page[ch.row()]) {
|
|
Packit |
1c1d7e |
from_unicode_page[ch.row()] = new char[256];
|
|
Packit |
1c1d7e |
for (int i=0; i<256; i++)
|
|
Packit |
1c1d7e |
from_unicode_page[ch.row()][i]=0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if ( mb_unicode ) {
|
|
Packit |
1c1d7e |
from_unicode_page[ch.row()][ch.cell()] = 0;
|
|
Packit |
1c1d7e |
if (!from_unicode_page_multibyte) {
|
|
Packit |
1c1d7e |
from_unicode_page_multibyte = new char**[256];
|
|
Packit |
1c1d7e |
for (int i=0; i<256; i++)
|
|
Packit |
1c1d7e |
from_unicode_page_multibyte[i]=0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if (!from_unicode_page_multibyte[ch.row()]) {
|
|
Packit |
1c1d7e |
from_unicode_page_multibyte[ch.row()] = new char*[256];
|
|
Packit |
1c1d7e |
for (int i=0; i<256; i++)
|
|
Packit |
1c1d7e |
from_unicode_page_multibyte[ch.row()][i] = 0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
mb[nmb++] = 0;
|
|
Packit |
1c1d7e |
from_unicode_page_multibyte[ch.row()][ch.cell()]
|
|
Packit |
1c1d7e |
= qstrdup(mb);
|
|
Packit |
1c1d7e |
*mb_unicode = unicode;
|
|
Packit |
1c1d7e |
} else {
|
|
Packit |
1c1d7e |
from_unicode_page[ch.row()][ch.cell()] = (char)byte;
|
|
Packit |
1c1d7e |
if ( to_unicode )
|
|
Packit |
1c1d7e |
to_unicode[byte] = unicode;
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
to_unicode_multibyte[byte].unicode = unicode;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
} else {
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
n = n.stripWhiteSpace();
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
unkn = '?'; // ##### Might be a bad choice.
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
~QTextCodecFromIOD()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( from_unicode_page ) {
|
|
Packit |
1c1d7e |
for (int i=0; i<256; i++)
|
|
Packit |
1c1d7e |
if (from_unicode_page[i])
|
|
Packit |
1c1d7e |
delete [] from_unicode_page[i];
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if ( from_unicode_page_multibyte ) {
|
|
Packit |
1c1d7e |
for (int i=0; i<256; i++)
|
|
Packit |
1c1d7e |
if (from_unicode_page_multibyte[i])
|
|
Packit |
1c1d7e |
for (int j=0; j<256; j++)
|
|
Packit |
1c1d7e |
if (from_unicode_page_multibyte[i][j])
|
|
Packit |
1c1d7e |
delete [] from_unicode_page_multibyte[i][j];
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if ( to_unicode )
|
|
Packit |
1c1d7e |
delete [] to_unicode;
|
|
Packit |
1c1d7e |
if ( to_unicode_multibyte )
|
|
Packit |
1c1d7e |
delete [] to_unicode_multibyte;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
bool ok() const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return !!from_unicode_page;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QTextDecoder* makeDecoder() const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( stateless() )
|
|
Packit |
1c1d7e |
return QTextCodec::makeDecoder();
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
return new QTextCodecFromIODDecoder(this);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
const char* name() const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return n;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int mibEnum() const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return 0; // #### Unknown.
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int heuristicContentMatch(const char*, int) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return 0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int heuristicNameMatch(const char* hint) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
int bestr = QTextCodec::heuristicNameMatch(hint);
|
|
Packit |
1c1d7e |
QStrListIterator it(aliases);
|
|
Packit |
1c1d7e |
char* a;
|
|
Packit |
1c1d7e |
while ((a=it.current())) {
|
|
Packit |
1c1d7e |
++it;
|
|
Packit |
1c1d7e |
int r = simpleHeuristicNameMatch(a,hint);
|
|
Packit |
1c1d7e |
if (r > bestr)
|
|
Packit |
1c1d7e |
bestr = r;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return bestr;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString toUnicode(const char* chars, int len) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
const uchar* uchars = (const uchar*)chars;
|
|
Packit |
1c1d7e |
QString result;
|
|
Packit |
1c1d7e |
QMultiByteUnicodeTable* multibyte=to_unicode_multibyte;
|
|
Packit |
1c1d7e |
if ( multibyte ) {
|
|
Packit |
1c1d7e |
while (len--) {
|
|
Packit |
1c1d7e |
QMultiByteUnicodeTable& mb = multibyte[*uchars];
|
|
Packit |
1c1d7e |
if ( mb.multibyte ) {
|
|
Packit |
1c1d7e |
// Chained multi-byte
|
|
Packit |
1c1d7e |
multibyte = mb.multibyte;
|
|
Packit |
1c1d7e |
} else {
|
|
Packit |
1c1d7e |
result += QChar(mb.unicode);
|
|
Packit |
1c1d7e |
multibyte=to_unicode_multibyte;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
uchars++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
} else {
|
|
Packit |
1c1d7e |
while (len--)
|
|
Packit |
1c1d7e |
result += QChar(to_unicode[*uchars++]);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return result;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QCString fromUnicode(const QString& uc, int& lenInOut) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if (lenInOut > (int)uc.length())
|
|
Packit |
1c1d7e |
lenInOut = uc.length();
|
|
Packit |
1c1d7e |
int rlen = lenInOut*max_bytes_per_char;
|
|
Packit |
1c1d7e |
QCString rstr(rlen);
|
|
Packit |
1c1d7e |
char* cursor = rstr.rawData();
|
|
Packit |
1c1d7e |
char* s=0;
|
|
Packit |
1c1d7e |
int l = lenInOut;
|
|
Packit |
1c1d7e |
int lout = 0;
|
|
Packit |
1c1d7e |
for (int i=0; i
|
|
Packit |
1c1d7e |
QChar ch = uc[i];
|
|
Packit |
1c1d7e |
if ( ch == QChar::null ) {
|
|
Packit |
1c1d7e |
// special
|
|
Packit |
1c1d7e |
*cursor++ = 0;
|
|
Packit |
1c1d7e |
} else if ( from_unicode_page[ch.row()] &&
|
|
Packit |
1c1d7e |
from_unicode_page[ch.row()][ch.cell()] )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
*cursor++ = from_unicode_page[ch.row()][ch.cell()];
|
|
Packit |
1c1d7e |
lout++;
|
|
Packit |
1c1d7e |
} else if ( from_unicode_page_multibyte &&
|
|
Packit |
1c1d7e |
from_unicode_page_multibyte[ch.row()] &&
|
|
Packit |
1c1d7e |
(s=from_unicode_page_multibyte[ch.row()][ch.cell()]) )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
while (*s) {
|
|
Packit |
1c1d7e |
*cursor++ = *s++;
|
|
Packit |
1c1d7e |
lout++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
} else {
|
|
Packit |
1c1d7e |
*cursor++ = unkn;
|
|
Packit |
1c1d7e |
lout++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
*cursor = 0;
|
|
Packit |
1c1d7e |
lenInOut = lout;
|
|
Packit |
1c1d7e |
return rstr;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QTextCodecFromIODDecoder::QTextCodecFromIODDecoder(const QTextCodecFromIOD* c) :
|
|
Packit |
1c1d7e |
codec(c)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
mb = codec->to_unicode_multibyte;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString QTextCodecFromIODDecoder::toUnicode(const char* chars, int len)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
const uchar* uchars = (const uchar*)chars;
|
|
Packit |
1c1d7e |
QString result;
|
|
Packit |
1c1d7e |
while (len--) {
|
|
Packit |
1c1d7e |
QMultiByteUnicodeTable& t = mb[*uchars];
|
|
Packit |
1c1d7e |
if ( t.multibyte ) {
|
|
Packit |
1c1d7e |
// Chained multi-byte
|
|
Packit |
1c1d7e |
mb = t.multibyte;
|
|
Packit |
1c1d7e |
} else {
|
|
Packit |
1c1d7e |
if ( t.unicode )
|
|
Packit |
1c1d7e |
result += QChar(t.unicode);
|
|
Packit |
1c1d7e |
mb=codec->to_unicode_multibyte;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
uchars++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return result;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Reads a POSIX2 charmap definition from \a iod.
|
|
Packit |
1c1d7e |
The parser recognizes the following lines:
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
<code_set_name> name
|
|
Packit |
1c1d7e |
<escape_char> character
|
|
Packit |
1c1d7e |
% alias alias
|
|
Packit |
1c1d7e |
CHARMAP
|
|
Packit |
1c1d7e |
<token> /xhexbyte <Uunicode> ...
|
|
Packit |
1c1d7e |
<token> /ddecbyte <Uunicode> ...
|
|
Packit |
1c1d7e |
<token> /octbyte <Uunicode> ...
|
|
Packit |
1c1d7e |
<token> /any/any... <Uunicode> ...
|
|
Packit |
1c1d7e |
END CHARMAP
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
The resulting QTextCodec is returned (and also added to the
|
|
Packit |
1c1d7e |
global list of codecs). The name() of the result is taken
|
|
Packit |
1c1d7e |
from the code_set_name.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Note that a codec constructed in this way uses much more memory
|
|
Packit |
1c1d7e |
and is slower than a hand-written QTextCodec subclass, since
|
|
Packit |
1c1d7e |
tables in code are in memory shared by all applications simultaneously
|
|
Packit |
1c1d7e |
using Qt.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
\sa loadCharmapFile()
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QTextCodec* QTextCodec::loadCharmap(QIODevice* iod)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QTextCodecFromIOD* r = new QTextCodecFromIOD(iod);
|
|
Packit |
1c1d7e |
if ( !r->ok() ) {
|
|
Packit |
1c1d7e |
delete r;
|
|
Packit |
1c1d7e |
r = 0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return r;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
A convenience function for loadCharmap().
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
QTextCodec* QTextCodec::loadCharmapFile(QString filename)
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QFile f(filename);
|
|
Packit |
1c1d7e |
if (f.open(IO_ReadOnly)) {
|
|
Packit |
1c1d7e |
QTextCodecFromIOD* r = new QTextCodecFromIOD(&f);
|
|
Packit |
1c1d7e |
if ( !r->ok() )
|
|
Packit |
1c1d7e |
delete r;
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
return r;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return 0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
#endif //QT_NO_CODECS
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*!
|
|
Packit |
1c1d7e |
Returns a string representing the current language.
|
|
Packit |
1c1d7e |
*/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
const char* QTextCodec::locale()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
static QCString lang;
|
|
Packit |
1c1d7e |
if ( lang.isEmpty() ) {
|
|
Packit |
1c1d7e |
lang = getenv( "LANG" ); //########Windows??
|
|
Packit |
1c1d7e |
if ( lang.isEmpty() )
|
|
Packit |
1c1d7e |
lang = "C";
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return lang;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CODECS
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
class QSimpleTextCodec: public QTextCodec
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
public:
|
|
Packit |
1c1d7e |
QSimpleTextCodec( int );
|
|
Packit |
1c1d7e |
~QSimpleTextCodec();
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString toUnicode(const char* chars, int len) const;
|
|
Packit |
1c1d7e |
QCString fromUnicode(const QString& uc, int& lenInOut ) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
const char* name() const;
|
|
Packit |
1c1d7e |
int mibEnum() const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int heuristicContentMatch(const char* chars, int len) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int heuristicNameMatch(const char* hint) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
private:
|
|
Packit |
1c1d7e |
int forwardIndex;
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#define LAST_MIB 2259
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static struct {
|
|
Packit |
1c1d7e |
const char * cs;
|
|
Packit |
1c1d7e |
int mib;
|
|
Packit |
1c1d7e |
Q_UINT16 values[128];
|
|
Packit |
1c1d7e |
} unicodevalues[] = {
|
|
Packit |
1c1d7e |
// from RFC 1489, ftp://ftp.isi.edu/in-notes/rfc1489.txt
|
|
Packit |
1c1d7e |
{ "KOI8-R", 2084,
|
|
Packit |
1c1d7e |
{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
|
|
Packit |
1c1d7e |
0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
|
|
Packit |
1c1d7e |
0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219/**/, 0x221A, 0x2248,
|
|
Packit |
1c1d7e |
0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7,
|
|
Packit |
1c1d7e |
0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556,
|
|
Packit |
1c1d7e |
0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x255C, 0x255D, 0x255E,
|
|
Packit |
1c1d7e |
0x255F, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565,
|
|
Packit |
1c1d7e |
0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x256B, 0x256C, 0x00A9,
|
|
Packit |
1c1d7e |
0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433,
|
|
Packit |
1c1d7e |
0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E,
|
|
Packit |
1c1d7e |
0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432,
|
|
Packit |
1c1d7e |
0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A,
|
|
Packit |
1c1d7e |
0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413,
|
|
Packit |
1c1d7e |
0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E,
|
|
Packit |
1c1d7e |
0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412,
|
|
Packit |
1c1d7e |
0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A } },
|
|
Packit |
1c1d7e |
// /**/ - The BULLET OPERATOR is confused. Some people think
|
|
Packit |
1c1d7e |
// it should be 0x2022 (BULLET).
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// from RFC 2319, ftp://ftp.isi.edu/in-notes/rfc2319.txt
|
|
Packit |
1c1d7e |
{ "KOI8-U", 2088,
|
|
Packit |
1c1d7e |
{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
|
|
Packit |
1c1d7e |
0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
|
|
Packit |
1c1d7e |
0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248,
|
|
Packit |
1c1d7e |
0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7,
|
|
Packit |
1c1d7e |
0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457,
|
|
Packit |
1c1d7e |
0x2557, 0x2558, 0x2559, 0x255A, 0x255B, 0x0491, 0x255D, 0x255E,
|
|
Packit |
1c1d7e |
0x255F, 0x2560, 0x2561, 0x0401, 0x0404, 0x2563, 0x0406, 0x0407,
|
|
Packit |
1c1d7e |
0x2566, 0x2567, 0x2568, 0x2569, 0x256A, 0x0490, 0x256C, 0x00A9,
|
|
Packit |
1c1d7e |
0x044E, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433,
|
|
Packit |
1c1d7e |
0x0445, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E,
|
|
Packit |
1c1d7e |
0x043F, 0x044F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432,
|
|
Packit |
1c1d7e |
0x044C, 0x044B, 0x0437, 0x0448, 0x044D, 0x0449, 0x0447, 0x044A,
|
|
Packit |
1c1d7e |
0x042E, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413,
|
|
Packit |
1c1d7e |
0x0425, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E,
|
|
Packit |
1c1d7e |
0x041F, 0x042F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412,
|
|
Packit |
1c1d7e |
0x042C, 0x042B, 0x0417, 0x0428, 0x042D, 0x0429, 0x0427, 0x042A } },
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// next bits generated from tables on the Unicode 2.0 CD. we can
|
|
Packit |
1c1d7e |
// use these tables since this is part of the transition to using
|
|
Packit |
1c1d7e |
// unicode everywhere in qt.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo 0x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; for a in 8859-* ; do ( awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ; cat /tmp/digits ) | sort | uniq -w4 | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// then I inserted the files manually.
|
|
Packit |
1c1d7e |
{ "ISO 8859-2", 5,
|
|
Packit |
1c1d7e |
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
|
Packit |
1c1d7e |
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
|
|
Packit |
1c1d7e |
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
|
Packit |
1c1d7e |
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
|
|
Packit |
1c1d7e |
0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B,
|
|
Packit |
1c1d7e |
0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7,
|
|
Packit |
1c1d7e |
0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C,
|
|
Packit |
1c1d7e |
0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7,
|
|
Packit |
1c1d7e |
0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
|
|
Packit |
1c1d7e |
0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7,
|
|
Packit |
1c1d7e |
0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
|
|
Packit |
1c1d7e |
0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7,
|
|
Packit |
1c1d7e |
0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
|
|
Packit |
1c1d7e |
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7,
|
|
Packit |
1c1d7e |
0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} },
|
|
Packit |
1c1d7e |
{ "ISO 8859-3", 6,
|
|
Packit |
1c1d7e |
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
|
Packit |
1c1d7e |
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
|
|
Packit |
1c1d7e |
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
|
Packit |
1c1d7e |
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
|
|
Packit |
1c1d7e |
0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0xFFFD, 0x0124, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0xFFFD, 0x017B,
|
|
Packit |
1c1d7e |
0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7,
|
|
Packit |
1c1d7e |
0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0xFFFD, 0x017C,
|
|
Packit |
1c1d7e |
0x00C0, 0x00C1, 0x00C2, 0xFFFD, 0x00C4, 0x010A, 0x0108, 0x00C7,
|
|
Packit |
1c1d7e |
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
|
|
Packit |
1c1d7e |
0xFFFD, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7,
|
|
Packit |
1c1d7e |
0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF,
|
|
Packit |
1c1d7e |
0x00E0, 0x00E1, 0x00E2, 0xFFFD, 0x00E4, 0x010B, 0x0109, 0x00E7,
|
|
Packit |
1c1d7e |
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
|
|
Packit |
1c1d7e |
0xFFFD, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7,
|
|
Packit |
1c1d7e |
0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9} },
|
|
Packit |
1c1d7e |
{ "ISO 8859-4", 7,
|
|
Packit |
1c1d7e |
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
|
Packit |
1c1d7e |
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
|
|
Packit |
1c1d7e |
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
|
Packit |
1c1d7e |
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
|
|
Packit |
1c1d7e |
0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF,
|
|
Packit |
1c1d7e |
0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7,
|
|
Packit |
1c1d7e |
0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B,
|
|
Packit |
1c1d7e |
0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E,
|
|
Packit |
1c1d7e |
0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A,
|
|
Packit |
1c1d7e |
0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
|
|
Packit |
1c1d7e |
0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF,
|
|
Packit |
1c1d7e |
0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F,
|
|
Packit |
1c1d7e |
0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B,
|
|
Packit |
1c1d7e |
0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
|
|
Packit |
1c1d7e |
0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9} },
|
|
Packit |
1c1d7e |
{ "ISO 8859-5", 8,
|
|
Packit |
1c1d7e |
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
|
Packit |
1c1d7e |
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
|
|
Packit |
1c1d7e |
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
|
Packit |
1c1d7e |
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
|
|
Packit |
1c1d7e |
0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407,
|
|
Packit |
1c1d7e |
0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F,
|
|
Packit |
1c1d7e |
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
|
|
Packit |
1c1d7e |
0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
|
|
Packit |
1c1d7e |
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
|
|
Packit |
1c1d7e |
0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
|
|
Packit |
1c1d7e |
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
|
|
Packit |
1c1d7e |
0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
|
|
Packit |
1c1d7e |
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
|
|
Packit |
1c1d7e |
0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
|
|
Packit |
1c1d7e |
0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457,
|
|
Packit |
1c1d7e |
0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F} },
|
|
Packit |
1c1d7e |
{ "ISO 8859-6-I", 82,
|
|
Packit |
1c1d7e |
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
|
Packit |
1c1d7e |
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
|
|
Packit |
1c1d7e |
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
|
Packit |
1c1d7e |
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
|
|
Packit |
1c1d7e |
0x00A0, 0xFFFD, 0xFFFD, 0xFFFD, 0x00A4, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x060C, 0x00AD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0x061B, 0xFFFD, 0xFFFD, 0xFFFD, 0x061F,
|
|
Packit |
1c1d7e |
0xFFFD, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
|
|
Packit |
1c1d7e |
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
|
|
Packit |
1c1d7e |
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637,
|
|
Packit |
1c1d7e |
0x0638, 0x0639, 0x063A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647,
|
|
Packit |
1c1d7e |
0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F,
|
|
Packit |
1c1d7e |
0x0650, 0x0651, 0x0652, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} },
|
|
Packit |
1c1d7e |
{ "ISO 8859-7", 10,
|
|
Packit |
1c1d7e |
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
|
Packit |
1c1d7e |
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
|
|
Packit |
1c1d7e |
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
|
Packit |
1c1d7e |
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
|
|
Packit |
1c1d7e |
0x00A0, 0x2018, 0x2019, 0x00A3, 0xFFFD, 0xFFFD, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x00A9, 0xFFFD, 0x00AB, 0x00AC, 0x00AD, 0xFFFD, 0x2015,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7,
|
|
Packit |
1c1d7e |
0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F,
|
|
Packit |
1c1d7e |
0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
|
|
Packit |
1c1d7e |
0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
|
|
Packit |
1c1d7e |
0x03A0, 0x03A1, 0xFFFD, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7,
|
|
Packit |
1c1d7e |
0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF,
|
|
Packit |
1c1d7e |
0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7,
|
|
Packit |
1c1d7e |
0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
|
|
Packit |
1c1d7e |
0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7,
|
|
Packit |
1c1d7e |
0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} },
|
|
Packit |
1c1d7e |
{ "ISO 8859-8-I", 85,
|
|
Packit |
1c1d7e |
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
|
Packit |
1c1d7e |
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
|
|
Packit |
1c1d7e |
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
|
Packit |
1c1d7e |
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
|
|
Packit |
1c1d7e |
0x00A0, 0xFFFD, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x203E,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2017,
|
|
Packit |
1c1d7e |
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7,
|
|
Packit |
1c1d7e |
0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
|
|
Packit |
1c1d7e |
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
|
|
Packit |
1c1d7e |
0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} },
|
|
Packit |
1c1d7e |
{ "ISO 8859-9", 12,
|
|
Packit |
1c1d7e |
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
|
Packit |
1c1d7e |
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
|
|
Packit |
1c1d7e |
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
|
Packit |
1c1d7e |
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
|
|
Packit |
1c1d7e |
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
|
Packit |
1c1d7e |
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
|
Packit |
1c1d7e |
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
|
|
Packit |
1c1d7e |
0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
|
|
Packit |
1c1d7e |
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF,
|
|
Packit |
1c1d7e |
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
|
Packit |
1c1d7e |
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
|
|
Packit |
1c1d7e |
0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
|
|
Packit |
1c1d7e |
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} },
|
|
Packit |
1c1d7e |
{ "ISO 8859-10", 13,
|
|
Packit |
1c1d7e |
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
|
Packit |
1c1d7e |
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
|
|
Packit |
1c1d7e |
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
|
Packit |
1c1d7e |
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
|
|
Packit |
1c1d7e |
0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7,
|
|
Packit |
1c1d7e |
0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A,
|
|
Packit |
1c1d7e |
0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7,
|
|
Packit |
1c1d7e |
0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2015, 0x016B, 0x014B,
|
|
Packit |
1c1d7e |
0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E,
|
|
Packit |
1c1d7e |
0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF,
|
|
Packit |
1c1d7e |
0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168,
|
|
Packit |
1c1d7e |
0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
|
|
Packit |
1c1d7e |
0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F,
|
|
Packit |
1c1d7e |
0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF,
|
|
Packit |
1c1d7e |
0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169,
|
|
Packit |
1c1d7e |
0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138} },
|
|
Packit |
1c1d7e |
{ "ISO 8859-13", 109,
|
|
Packit |
1c1d7e |
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
|
Packit |
1c1d7e |
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
|
|
Packit |
1c1d7e |
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
|
Packit |
1c1d7e |
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
|
|
Packit |
1c1d7e |
0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6,
|
|
Packit |
1c1d7e |
0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112,
|
|
Packit |
1c1d7e |
0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B,
|
|
Packit |
1c1d7e |
0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7,
|
|
Packit |
1c1d7e |
0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF,
|
|
Packit |
1c1d7e |
0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113,
|
|
Packit |
1c1d7e |
0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
|
|
Packit |
1c1d7e |
0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7,
|
|
Packit |
1c1d7e |
0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019} },
|
|
Packit |
1c1d7e |
{ "ISO 8859-14", 110,
|
|
Packit |
1c1d7e |
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
|
Packit |
1c1d7e |
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
|
|
Packit |
1c1d7e |
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
|
Packit |
1c1d7e |
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
|
|
Packit |
1c1d7e |
0x00A0, 0x1E02, 0x1E03, 0x00A3, 0x010A, 0x010B, 0x1E0A, 0x00A7,
|
|
Packit |
1c1d7e |
0x1E80, 0x00A9, 0x1E82, 0x1E0B, 0x1EF2, 0x00AD, 0x00AE, 0x0178,
|
|
Packit |
1c1d7e |
0x1E1E, 0x1E1F, 0x0120, 0x0121, 0x1E40, 0x1E41, 0x00B6, 0x1E56,
|
|
Packit |
1c1d7e |
0x1E81, 0x1E57, 0x1E83, 0x1E60, 0x1EF3, 0x1E84, 0x1E85, 0x1E61,
|
|
Packit |
1c1d7e |
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
|
Packit |
1c1d7e |
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
|
|
Packit |
1c1d7e |
0x0174, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x1E6A,
|
|
Packit |
1c1d7e |
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x0176, 0x00DF,
|
|
Packit |
1c1d7e |
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
|
Packit |
1c1d7e |
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
|
|
Packit |
1c1d7e |
0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B,
|
|
Packit |
1c1d7e |
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF} },
|
|
Packit |
1c1d7e |
{ "ISO 8859-15", 111,
|
|
Packit |
1c1d7e |
{ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
|
|
Packit |
1c1d7e |
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
|
|
Packit |
1c1d7e |
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
|
|
Packit |
1c1d7e |
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
|
|
Packit |
1c1d7e |
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0160, 0x00A7,
|
|
Packit |
1c1d7e |
0x0161, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x017D, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x017E, 0x00B9, 0x00BA, 0x00BB, 0x0152, 0x0153, 0x0178, 0x00BF,
|
|
Packit |
1c1d7e |
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
|
Packit |
1c1d7e |
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
|
|
Packit |
1c1d7e |
0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
|
|
Packit |
1c1d7e |
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
|
|
Packit |
1c1d7e |
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
|
Packit |
1c1d7e |
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
|
|
Packit |
1c1d7e |
0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
|
|
Packit |
1c1d7e |
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF} },
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// next bits generated again from tables on the Unicode 3.0 CD.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// $ for a in CP* ; do ( awk '/^0x[89ABCDEF]/{ print $1, $2 }' < $a ) | sort | sed -e 's/#UNDEF.*$/0xFFFD/' | cut -c6- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/$a ; done
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
{ "CP 874", 0, //### what is the mib?
|
|
Packit |
1c1d7e |
{ 0x20AC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x2026, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07,
|
|
Packit |
1c1d7e |
0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F,
|
|
Packit |
1c1d7e |
0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17,
|
|
Packit |
1c1d7e |
0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F,
|
|
Packit |
1c1d7e |
0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27,
|
|
Packit |
1c1d7e |
0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F,
|
|
Packit |
1c1d7e |
0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37,
|
|
Packit |
1c1d7e |
0x0E38, 0x0E39, 0x0E3A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0E3F,
|
|
Packit |
1c1d7e |
0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47,
|
|
Packit |
1c1d7e |
0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F,
|
|
Packit |
1c1d7e |
0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57,
|
|
Packit |
1c1d7e |
0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} },
|
|
Packit |
1c1d7e |
{ "CP 1250", 2250,
|
|
Packit |
1c1d7e |
{ 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A,
|
|
Packit |
1c1d7e |
0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C,
|
|
Packit |
1c1d7e |
0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7,
|
|
Packit |
1c1d7e |
0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
|
|
Packit |
1c1d7e |
0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7,
|
|
Packit |
1c1d7e |
0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
|
|
Packit |
1c1d7e |
0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7,
|
|
Packit |
1c1d7e |
0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
|
|
Packit |
1c1d7e |
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7,
|
|
Packit |
1c1d7e |
0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9} },
|
|
Packit |
1c1d7e |
{ "CP 1251", 2251,
|
|
Packit |
1c1d7e |
{ 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021,
|
|
Packit |
1c1d7e |
0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F,
|
|
Packit |
1c1d7e |
0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F,
|
|
Packit |
1c1d7e |
0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457,
|
|
Packit |
1c1d7e |
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
|
|
Packit |
1c1d7e |
0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
|
|
Packit |
1c1d7e |
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
|
|
Packit |
1c1d7e |
0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
|
|
Packit |
1c1d7e |
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
|
|
Packit |
1c1d7e |
0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
|
|
Packit |
1c1d7e |
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
|
|
Packit |
1c1d7e |
0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F} },
|
|
Packit |
1c1d7e |
{ "CP 1252", 2252,
|
|
Packit |
1c1d7e |
{ 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
|
Packit |
1c1d7e |
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0x017D, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
|
Packit |
1c1d7e |
0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFD, 0x017E, 0x0178,
|
|
Packit |
1c1d7e |
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
|
Packit |
1c1d7e |
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
|
Packit |
1c1d7e |
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
|
|
Packit |
1c1d7e |
0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
|
|
Packit |
1c1d7e |
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
|
|
Packit |
1c1d7e |
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
|
Packit |
1c1d7e |
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
|
|
Packit |
1c1d7e |
0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
|
|
Packit |
1c1d7e |
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF} },
|
|
Packit |
1c1d7e |
{ "CP 1253", 2253,
|
|
Packit |
1c1d7e |
{ 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x00A9, 0xFFFD, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F,
|
|
Packit |
1c1d7e |
0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
|
|
Packit |
1c1d7e |
0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
|
|
Packit |
1c1d7e |
0x03A0, 0x03A1, 0xFFFD, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7,
|
|
Packit |
1c1d7e |
0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF,
|
|
Packit |
1c1d7e |
0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7,
|
|
Packit |
1c1d7e |
0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
|
|
Packit |
1c1d7e |
0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7,
|
|
Packit |
1c1d7e |
0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFD} },
|
|
Packit |
1c1d7e |
{ "CP 1254", 2254,
|
|
Packit |
1c1d7e |
{ 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
|
Packit |
1c1d7e |
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
|
Packit |
1c1d7e |
0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFD, 0xFFFD, 0x0178,
|
|
Packit |
1c1d7e |
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
|
Packit |
1c1d7e |
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
|
Packit |
1c1d7e |
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
|
|
Packit |
1c1d7e |
0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
|
|
Packit |
1c1d7e |
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF,
|
|
Packit |
1c1d7e |
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
|
Packit |
1c1d7e |
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
|
|
Packit |
1c1d7e |
0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
|
|
Packit |
1c1d7e |
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF} },
|
|
Packit |
1c1d7e |
{ "CP 1255", 2255,
|
|
Packit |
1c1d7e |
{ 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
|
Packit |
1c1d7e |
0x02C6, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
|
Packit |
1c1d7e |
0x02DC, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
|
Packit |
1c1d7e |
0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7,
|
|
Packit |
1c1d7e |
0x05B8, 0x05B9, 0xFFFD, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF,
|
|
Packit |
1c1d7e |
0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3,
|
|
Packit |
1c1d7e |
0x05F4, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7,
|
|
Packit |
1c1d7e |
0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
|
|
Packit |
1c1d7e |
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
|
|
Packit |
1c1d7e |
0x05E8, 0x05E9, 0x05EA, 0xFFFD, 0xFFFD, 0x200E, 0x200F, 0xFFFD} },
|
|
Packit |
1c1d7e |
{ "CP 1256", 2256,
|
|
Packit |
1c1d7e |
{ 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
|
Packit |
1c1d7e |
0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688,
|
|
Packit |
1c1d7e |
0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
|
Packit |
1c1d7e |
0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA,
|
|
Packit |
1c1d7e |
0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F,
|
|
Packit |
1c1d7e |
0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
|
|
Packit |
1c1d7e |
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
|
|
Packit |
1c1d7e |
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7,
|
|
Packit |
1c1d7e |
0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643,
|
|
Packit |
1c1d7e |
0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7,
|
|
Packit |
1c1d7e |
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF,
|
|
Packit |
1c1d7e |
0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7,
|
|
Packit |
1c1d7e |
0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2} },
|
|
Packit |
1c1d7e |
{ "CP 1257", 2257,
|
|
Packit |
1c1d7e |
{ 0x20AC, 0xFFFD, 0x201A, 0xFFFD, 0x201E, 0x2026, 0x2020, 0x2021,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2030, 0xFFFD, 0x2039, 0xFFFD, 0x00A8, 0x02C7, 0x00B8,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2122, 0xFFFD, 0x203A, 0xFFFD, 0x00AF, 0x02DB, 0xFFFD,
|
|
Packit |
1c1d7e |
0x00A0, 0xFFFD, 0x00A2, 0x00A3, 0x00A4, 0xFFFD, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6,
|
|
Packit |
1c1d7e |
0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112,
|
|
Packit |
1c1d7e |
0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B,
|
|
Packit |
1c1d7e |
0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7,
|
|
Packit |
1c1d7e |
0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF,
|
|
Packit |
1c1d7e |
0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113,
|
|
Packit |
1c1d7e |
0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
|
|
Packit |
1c1d7e |
0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7,
|
|
Packit |
1c1d7e |
0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9} },
|
|
Packit |
1c1d7e |
{ "CP 1258", 2258,
|
|
Packit |
1c1d7e |
{ 0x20AC, 0xFFFD, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
|
Packit |
1c1d7e |
0x02C6, 0x2030, 0xFFFD, 0x2039, 0x0152, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
|
Packit |
1c1d7e |
0x02DC, 0x2122, 0xFFFD, 0x203A, 0x0153, 0xFFFD, 0xFFFD, 0x0178,
|
|
Packit |
1c1d7e |
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
|
Packit |
1c1d7e |
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
|
Packit |
1c1d7e |
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
|
Packit |
1c1d7e |
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
|
Packit |
1c1d7e |
0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
|
Packit |
1c1d7e |
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF,
|
|
Packit |
1c1d7e |
0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7,
|
|
Packit |
1c1d7e |
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF,
|
|
Packit |
1c1d7e |
0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
|
Packit |
1c1d7e |
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF,
|
|
Packit |
1c1d7e |
0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7,
|
|
Packit |
1c1d7e |
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF} },
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// this one is generated from the charmap file located in /usr/share/i18n/charmaps
|
|
Packit |
1c1d7e |
// on most Linux distributions. The thai character set tis620 is byte by byte equivalent
|
|
Packit |
1c1d7e |
// to iso8859-11, so we name it 8859-11 here, but recognise the name tis620 too.
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// $ for A in 8 9 A B C D E F ; do for B in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo x${A}${B} 0xFFFD ; done ; done > /tmp/digits ; ( cut -c25- < TIS-620 ; cat /tmp/digits ) | awk '/^x[89ABCDEF]/{ print $1, $2 }' | sed -e 's/<U/0x/' -e 's/>//' | sort | uniq -w4 | cut -c5- | paste '-d ' - - - - - - - - | sed -e 's/ /, /g' -e 's/$/,/' -e '$ s/,$/} },/' -e '1 s/^/{ /' > ~/tmp/tis-620
|
|
Packit |
1c1d7e |
{ "ISO 8859-11", 2259, // Thai character set mib enum taken from tis620 (which is byte by byte equivalent)
|
|
Packit |
1c1d7e |
{ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
|
Packit |
1c1d7e |
0xFFFD, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07,
|
|
Packit |
1c1d7e |
0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F,
|
|
Packit |
1c1d7e |
0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17,
|
|
Packit |
1c1d7e |
0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F,
|
|
Packit |
1c1d7e |
0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27,
|
|
Packit |
1c1d7e |
0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F,
|
|
Packit |
1c1d7e |
0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37,
|
|
Packit |
1c1d7e |
0x0E38, 0x0E39, 0x0E3A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0E3F,
|
|
Packit |
1c1d7e |
0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47,
|
|
Packit |
1c1d7e |
0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F,
|
|
Packit |
1c1d7e |
0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57,
|
|
Packit |
1c1d7e |
0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD} },
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// change LAST_MIB if you add more, and edit unicodevalues in
|
|
Packit |
1c1d7e |
// kernel/qpsprinter.cpp too.
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static const QSimpleTextCodec * reverseOwner = 0;
|
|
Packit |
1c1d7e |
static QArray<char> * reverseMap = 0;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QSimpleTextCodec::QSimpleTextCodec( int i )
|
|
Packit |
1c1d7e |
: QTextCodec(), forwardIndex( i )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QSimpleTextCodec::~QSimpleTextCodec()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( reverseOwner == this ) {
|
|
Packit |
1c1d7e |
delete reverseMap;
|
|
Packit |
1c1d7e |
reverseMap = 0;
|
|
Packit |
1c1d7e |
reverseOwner = 0;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// what happens if strlen(chars)
|
|
Packit |
1c1d7e |
QString QSimpleTextCodec::toUnicode(const char* chars, int len) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if(len <= 0)
|
|
Packit |
1c1d7e |
return QString::null;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int clen = qstrlen(chars);
|
|
Packit |
1c1d7e |
len = QMIN(len, clen); // Note: NUL ends string
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString r;
|
|
Packit |
1c1d7e |
r.setUnicode(0, len);
|
|
Packit |
1c1d7e |
QChar* uc = (QChar*)r.unicode(); // const_cast
|
|
Packit |
1c1d7e |
const unsigned char * c = (const unsigned char *)chars;
|
|
Packit |
1c1d7e |
for( int i=0; i
|
|
Packit |
1c1d7e |
if ( c[i] > 127 )
|
|
Packit |
1c1d7e |
uc[i] = unicodevalues[forwardIndex].values[c[i]-128];
|
|
Packit |
1c1d7e |
else
|
|
Packit |
1c1d7e |
uc[i] = c[i];
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return r;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QCString QSimpleTextCodec::fromUnicode(const QString& uc, int& len ) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( reverseOwner != this ) {
|
|
Packit |
1c1d7e |
int m = 0;
|
|
Packit |
1c1d7e |
int i = 0;
|
|
Packit |
1c1d7e |
while( i < 128 ) {
|
|
Packit |
1c1d7e |
if ( unicodevalues[forwardIndex].values[i] > m &&
|
|
Packit |
1c1d7e |
unicodevalues[forwardIndex].values[i] < 0xfffd )
|
|
Packit |
1c1d7e |
m = unicodevalues[forwardIndex].values[i];
|
|
Packit |
1c1d7e |
i++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
m++;
|
|
Packit |
1c1d7e |
if ( !reverseMap )
|
|
Packit |
1c1d7e |
reverseMap = new QArray<char>( m );
|
|
Packit |
1c1d7e |
if ( m > (int)(reverseMap->size()) )
|
|
Packit |
1c1d7e |
reverseMap->resize( m );
|
|
Packit |
1c1d7e |
for( i = 0; i < 128 && i < m; i++ )
|
|
Packit |
1c1d7e |
(*reverseMap)[i] = (char)i;
|
|
Packit |
1c1d7e |
for( ;i < m; i++ )
|
|
Packit |
1c1d7e |
(*reverseMap)[i] = '?';
|
|
Packit |
1c1d7e |
for( i=128; i<256; i++ ) {
|
|
Packit |
1c1d7e |
int u = unicodevalues[forwardIndex].values[i-128];
|
|
Packit |
1c1d7e |
if ( u < m )
|
|
Packit |
1c1d7e |
(*reverseMap)[u] = (char)(unsigned char)(i);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
reverseOwner = this;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if ( len <0 || len > (int)uc.length() )
|
|
Packit |
1c1d7e |
len = uc.length();
|
|
Packit |
1c1d7e |
QCString r( len+1 );
|
|
Packit |
1c1d7e |
int i = len;
|
|
Packit |
1c1d7e |
int u;
|
|
Packit |
1c1d7e |
const QChar* ucp = uc.unicode();
|
|
Packit |
1c1d7e |
char* rp = r.rawData();
|
|
Packit |
1c1d7e |
char* rmp = reverseMap->data();
|
|
Packit |
1c1d7e |
int rmsize = (int) reverseMap->size();
|
|
Packit |
1c1d7e |
while( i-- )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
u = ucp->unicode();
|
|
Packit |
1c1d7e |
*rp++ = u < 128 ? u : (( u < rmsize ) ? (*(rmp+u)) : '?' );
|
|
Packit |
1c1d7e |
ucp++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
r[len] = 0;
|
|
Packit |
1c1d7e |
return r;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
const char* QSimpleTextCodec::name() const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return unicodevalues[forwardIndex].cs;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int QSimpleTextCodec::mibEnum() const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return unicodevalues[forwardIndex].mib;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int QSimpleTextCodec::heuristicNameMatch(const char* hint) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( hint[0]=='k' ) {
|
|
Packit |
1c1d7e |
// Help people with messy fonts
|
|
Packit |
1c1d7e |
if ( QCString(hint) == "koi8-1" )
|
|
Packit |
1c1d7e |
return QTextCodec::heuristicNameMatch("koi8-r")-1;
|
|
Packit |
1c1d7e |
if ( QCString(hint) == "koi8-ru" )
|
|
Packit |
1c1d7e |
return QTextCodec::heuristicNameMatch("koi8-r")-1;
|
|
Packit |
1c1d7e |
} else if ( hint[0] == 't' && QCString(name()) == "ISO 8859-11" ) {
|
|
Packit |
1c1d7e |
// 8859-11 and tis620 are byte by bute equivalent
|
|
Packit |
1c1d7e |
int i = simpleHeuristicNameMatch("tis620-0", hint);
|
|
Packit |
1c1d7e |
if( !i )
|
|
Packit |
1c1d7e |
i = simpleHeuristicNameMatch("tis-620", hint);
|
|
Packit |
1c1d7e |
if( i ) return i;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return QTextCodec::heuristicNameMatch(hint);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int QSimpleTextCodec::heuristicContentMatch(const char* chars, int len) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( len<1 || !chars )
|
|
Packit |
1c1d7e |
return -1;
|
|
Packit |
1c1d7e |
int i = 0;
|
|
Packit |
1c1d7e |
const uchar * c = (const unsigned char *)chars;
|
|
Packit |
1c1d7e |
int r = 0;
|
|
Packit |
1c1d7e |
while( i
|
|
Packit |
1c1d7e |
if ( *c >= 128 ) {
|
|
Packit |
1c1d7e |
if ( unicodevalues[forwardIndex].values[(*c)-128] == 0xfffd )
|
|
Packit |
1c1d7e |
return -1;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if ( (*c >= ' ' && *c < 127) ||
|
|
Packit |
1c1d7e |
*c == '\n' || *c == '\t' || *c == '\r' )
|
|
Packit |
1c1d7e |
r++;
|
|
Packit |
1c1d7e |
i++;
|
|
Packit |
1c1d7e |
c++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
if ( mibEnum()==4 )
|
|
Packit |
1c1d7e |
r+=1;
|
|
Packit |
1c1d7e |
return r;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#endif // QT_NO_CODECS
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
class QLatin1Codec: public QTextCodec
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
public:
|
|
Packit |
1c1d7e |
QLatin1Codec();
|
|
Packit |
1c1d7e |
~QLatin1Codec();
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString toUnicode(const char* chars, int len) const;
|
|
Packit |
1c1d7e |
QCString fromUnicode(const QString& uc, int& lenInOut ) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
const char* name() const;
|
|
Packit |
1c1d7e |
int mibEnum() const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int heuristicContentMatch(const char* chars, int len) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int heuristicNameMatch(const char* hint) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
private:
|
|
Packit |
1c1d7e |
//int forwardIndex;
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QLatin1Codec::QLatin1Codec()
|
|
Packit |
1c1d7e |
: QTextCodec()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QLatin1Codec::~QLatin1Codec()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// what happens if strlen(chars)
|
|
Packit |
1c1d7e |
QString QLatin1Codec::toUnicode(const char* chars, int len) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if(len <= 0)
|
|
Packit |
1c1d7e |
return QString::null;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
return QString::fromLatin1(chars, len);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QCString QLatin1Codec::fromUnicode(const QString& uc, int& len ) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( len <0 || len > (int)uc.length() )
|
|
Packit |
1c1d7e |
len = uc.length();
|
|
Packit |
1c1d7e |
QCString r( len+1 );
|
|
Packit |
1c1d7e |
int i = 0;
|
|
Packit |
1c1d7e |
const QChar *ch = uc.unicode();
|
|
Packit |
1c1d7e |
while ( i < len ) {
|
|
Packit |
1c1d7e |
r[i] = ch->row() ? '?' : ch->cell();
|
|
Packit |
1c1d7e |
i++;
|
|
Packit |
1c1d7e |
ch++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
r[len] = 0;
|
|
Packit |
1c1d7e |
return r;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
const char* QLatin1Codec::name() const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return "ISO 8859-1";
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int QLatin1Codec::mibEnum() const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return 4;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int QLatin1Codec::heuristicNameMatch(const char* hint) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return QTextCodec::heuristicNameMatch(hint);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int QLatin1Codec::heuristicContentMatch(const char* chars, int len) const
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( len<1 || !chars )
|
|
Packit |
1c1d7e |
return -1;
|
|
Packit |
1c1d7e |
int i = 0;
|
|
Packit |
1c1d7e |
const uchar * c = (const unsigned char *)chars;
|
|
Packit |
1c1d7e |
int r = 0;
|
|
Packit |
1c1d7e |
while( i
|
|
Packit |
1c1d7e |
if ( *c >= 0x80 && *c < 0xa0 )
|
|
Packit |
1c1d7e |
return -1;
|
|
Packit |
1c1d7e |
if ( (*c >= ' ' && *c < 127) ||
|
|
Packit |
1c1d7e |
*c == '\n' || *c == '\t' || *c == '\r' )
|
|
Packit |
1c1d7e |
r++;
|
|
Packit |
1c1d7e |
i++;
|
|
Packit |
1c1d7e |
c++;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
return r;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static void setupBuiltinCodecs()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
(void)new QLatin1Codec;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CODECS
|
|
Packit |
1c1d7e |
int i = 0;
|
|
Packit |
1c1d7e |
do {
|
|
Packit |
1c1d7e |
(void)new QSimpleTextCodec( i );
|
|
Packit |
1c1d7e |
} while( unicodevalues[i++].mib != LAST_MIB );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
//(void)new QEucJpCodec;
|
|
Packit |
1c1d7e |
//(void)new QSjisCodec;
|
|
Packit |
1c1d7e |
//(void)new QJisCodec;
|
|
Packit |
1c1d7e |
//(void)new QEucKrCodec;
|
|
Packit |
1c1d7e |
//(void)new QGbkCodec;
|
|
Packit |
1c1d7e |
//(void)new QBig5Codec;
|
|
Packit |
1c1d7e |
(void)new QUtf8Codec;
|
|
Packit |
1c1d7e |
(void)new QUtf16Codec;
|
|
Packit |
1c1d7e |
//(void)new QHebrewCodec;
|
|
Packit |
1c1d7e |
//(void)new QArabicCodec;
|
|
Packit |
1c1d7e |
//(void)new QTsciiCodec;
|
|
Packit |
1c1d7e |
#endif // QT_NO_CODECS
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#endif // QT_NO_TEXTCODEC
|