mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-26 01:24:39 +03:00
1133 lines
46 KiB
C
1133 lines
46 KiB
C
|
/* eci_sb.h - Extended Channel Interpretations single-byte and UCS-2 BE
|
||
|
|
||
|
libzint - the open source barcode library
|
||
|
Copyright (C) 2021 Robin Stuart <rstuart114@gmail.com>
|
||
|
|
||
|
Redistribution and use in source and binary forms, with or without
|
||
|
modification, are permitted provided that the following conditions
|
||
|
are met:
|
||
|
|
||
|
1. Redistributions of source code must retain the above copyright
|
||
|
notice, this list of conditions and the following disclaimer.
|
||
|
2. Redistributions in binary form must reproduce the above copyright
|
||
|
notice, this list of conditions and the following disclaimer in the
|
||
|
documentation and/or other materials provided with the distribution.
|
||
|
3. Neither the name of the project nor the names of its contributors
|
||
|
may be used to endorse or promote products derived from this software
|
||
|
without specific prior written permission.
|
||
|
|
||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||
|
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||
|
SUCH DAMAGE.
|
||
|
*/
|
||
|
/* vim: set ts=4 sw=4 et : */
|
||
|
|
||
|
#ifndef ECI_SB_H
|
||
|
#define ECI_SB_H
|
||
|
|
||
|
/*
|
||
|
* Adapted from GNU LIBICONV library */
|
||
|
/*
|
||
|
* Copyright (C) 1999-2001, 2005, 2012, 2016 Free Software Foundation, Inc.
|
||
|
* This file is part of the GNU LIBICONV Library.
|
||
|
*
|
||
|
* The GNU LIBICONV Library is free software; you can redistribute it
|
||
|
* and/or modify it under the terms of the GNU Library General Public
|
||
|
* License as published by the Free Software Foundation; either version 2
|
||
|
* of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* The GNU LIBICONV Library is distributed in the hope that it will be
|
||
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Library General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Library General Public
|
||
|
* License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
||
|
* If not, see <https://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-2 (libiconv-1.16/lib/iso8859_2.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_2_page00[224] = {
|
||
|
0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */
|
||
|
0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
|
||
|
0xb0, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
|
||
|
0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
|
||
|
0x00, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7, /* 0xc0-0xc7 */
|
||
|
0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00, /* 0xc8-0xcf */
|
||
|
0x00, 0x00, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */
|
||
|
0x00, 0x00, 0xda, 0x00, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */
|
||
|
0x00, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */
|
||
|
0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00, /* 0xe8-0xef */
|
||
|
0x00, 0x00, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */
|
||
|
0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */
|
||
|
/* 0x0100 */
|
||
|
0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xb1, 0xc6, 0xe6, /* 0x00-0x07 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */
|
||
|
0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0xca, 0xea, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
|
||
|
0x00, 0xc5, 0xe5, 0x00, 0x00, 0xa5, 0xb5, 0x00, /* 0x38-0x3f */
|
||
|
0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0xd2, /* 0x40-0x47 */
|
||
|
0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */
|
||
|
0xd5, 0xf5, 0x00, 0x00, 0xc0, 0xe0, 0x00, 0x00, /* 0x50-0x57 */
|
||
|
0xd8, 0xf8, 0xa6, 0xb6, 0x00, 0x00, 0xaa, 0xba, /* 0x58-0x5f */
|
||
|
0xa9, 0xb9, 0xde, 0xfe, 0xab, 0xbb, 0x00, 0x00, /* 0x60-0x67 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd9, 0xf9, /* 0x68-0x6f */
|
||
|
0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0x00, 0xac, 0xbc, 0xaf, 0xbf, 0xae, 0xbe, 0x00, /* 0x78-0x7f */
|
||
|
};
|
||
|
static const unsigned char iso8859_2_page02[32] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xc0-0xc7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
|
||
|
0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */
|
||
|
};
|
||
|
|
||
|
/* ECI 4 ISO/IEC 8859-2 Latin alphabet No. 2 (Latin-2) */
|
||
|
static int iso8859_2_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00a0) {
|
||
|
if (wc >= 0x0080) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x0180) {
|
||
|
c = iso8859_2_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x02c0 && wc < 0x02e0) {
|
||
|
c = iso8859_2_page02[wc-0x02c0];
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-3 (libiconv-1.16/lib/iso8859_3.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_3_page00[96] = {
|
||
|
0xa0, 0x00, 0x00, 0xa3, 0xa4, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */
|
||
|
0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
|
||
|
0xb0, 0x00, 0xb2, 0xb3, 0xb4, 0xb5, 0x00, 0xb7, /* 0xb0-0xb7 */
|
||
|
0xb8, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */
|
||
|
0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7, /* 0xc0-0xc7 */
|
||
|
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
|
||
|
0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */
|
||
|
0x00, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */
|
||
|
0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */
|
||
|
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
|
||
|
0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */
|
||
|
0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */
|
||
|
};
|
||
|
static const unsigned char iso8859_3_page01[120] = {
|
||
|
0xc6, 0xe6, 0xc5, 0xe5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xd8, 0xf8, 0xab, 0xbb, /* 0x18-0x1f */
|
||
|
0xd5, 0xf5, 0x00, 0x00, 0xa6, 0xb6, 0xa1, 0xb1, /* 0x20-0x27 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */
|
||
|
0xa9, 0xb9, 0x00, 0x00, 0xac, 0xbc, 0x00, 0x00, /* 0x30-0x37 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, 0xaa, 0xba, /* 0x58-0x5f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xdd, 0xfd, 0x00, 0x00, /* 0x68-0x6f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0x00, 0x00, 0x00, 0xaf, 0xbf, 0x00, 0x00, 0x00, /* 0x78-0x7f */
|
||
|
};
|
||
|
static const unsigned char iso8859_3_page02[8] = {
|
||
|
0xa2, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
|
||
|
};
|
||
|
|
||
|
/* ECI 5 ISO/IEC 8859-3 Latin alphabet No. 3 (Latin-3) (South European) */
|
||
|
static int iso8859_3_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00a0) {
|
||
|
if (wc >= 0x0080) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x0100) {
|
||
|
c = iso8859_3_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x0108 && wc < 0x0180) {
|
||
|
c = iso8859_3_page01[wc-0x0108];
|
||
|
} else if (wc >= 0x02d8 && wc < 0x02e0) {
|
||
|
c = iso8859_3_page02[wc-0x02d8];
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-4 (libiconv-1.16/lib/iso8859_4.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_4_page00[224] = {
|
||
|
0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */
|
||
|
0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0xaf, /* 0xa8-0xaf */
|
||
|
0xb0, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
|
||
|
0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
|
||
|
0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00, /* 0xc0-0xc7 */
|
||
|
0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00, /* 0xc8-0xcf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
|
||
|
0xd8, 0x00, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */
|
||
|
0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */
|
||
|
0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00, /* 0xe8-0xef */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
|
||
|
0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */
|
||
|
/* 0x0100 */
|
||
|
0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00, /* 0x00-0x07 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */
|
||
|
0xd0, 0xf0, 0xaa, 0xba, 0x00, 0x00, 0xcc, 0xec, /* 0x10-0x17 */
|
||
|
0xca, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
|
||
|
0x00, 0x00, 0xab, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
|
||
|
0xa5, 0xb5, 0xcf, 0xef, 0x00, 0x00, 0xc7, 0xe7, /* 0x28-0x2f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd3, 0xf3, /* 0x30-0x37 */
|
||
|
0xa2, 0x00, 0x00, 0xa6, 0xb6, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf1, 0x00, /* 0x40-0x47 */
|
||
|
0x00, 0x00, 0xbd, 0xbf, 0xd2, 0xf2, 0x00, 0x00, /* 0x48-0x4f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0xb3, /* 0x50-0x57 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
|
||
|
0xa9, 0xb9, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc, /* 0x60-0x67 */
|
||
|
0xdd, 0xfd, 0xde, 0xfe, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
|
||
|
0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xbe, 0x00, /* 0x78-0x7f */
|
||
|
};
|
||
|
static const unsigned char iso8859_4_page02[32] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xc0-0xc7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
|
||
|
0x00, 0xff, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
|
||
|
};
|
||
|
|
||
|
/* ECI 6 ISO/IEC 8859-4 Latin alphabet No. 4 (Latin-4) (North European) */
|
||
|
static int iso8859_4_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00a0) {
|
||
|
if (wc >= 0x0080) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x0180) {
|
||
|
c = iso8859_4_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x02c0 && wc < 0x02e0) {
|
||
|
c = iso8859_4_page02[wc-0x02c0];
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-5 (libiconv-1.16/lib/iso8859_5.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_5_page00[16] = {
|
||
|
0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, /* 0xa0-0xa7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
|
||
|
};
|
||
|
static const unsigned char iso8859_5_page04[96] = {
|
||
|
0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */
|
||
|
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x08-0x0f */
|
||
|
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */
|
||
|
0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */
|
||
|
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */
|
||
|
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */
|
||
|
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */
|
||
|
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x38-0x3f */
|
||
|
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */
|
||
|
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */
|
||
|
0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */
|
||
|
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff, /* 0x58-0x5f */
|
||
|
};
|
||
|
|
||
|
/* ECI 7 ISO/IEC 8859-5 Latin/Cyrillic */
|
||
|
static int iso8859_5_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00a0) {
|
||
|
if (wc >= 0x0080) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x00b0) {
|
||
|
c = iso8859_5_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x0400 && wc < 0x0460) {
|
||
|
c = iso8859_5_page04[wc-0x0400];
|
||
|
} else if (wc == 0x2116) {
|
||
|
c = 0xf0;
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-6 (libiconv-1.16/lib/iso8859_6.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_6_page00[16] = {
|
||
|
0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
|
||
|
};
|
||
|
static const unsigned char iso8859_6_page06[80] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */
|
||
|
0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */
|
||
|
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */
|
||
|
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */
|
||
|
0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */
|
||
|
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */
|
||
|
0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
|
||
|
};
|
||
|
|
||
|
/* ECI 8 ISO/IEC 8859-6 Latin/Arabic */
|
||
|
static int iso8859_6_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00a0) {
|
||
|
if (wc >= 0x0080) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x00b0) {
|
||
|
c = iso8859_6_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x0608 && wc < 0x0658) {
|
||
|
c = iso8859_6_page06[wc-0x0608];
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-7 (libiconv-1.16/lib/iso8859_7.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_7_page00[32] = {
|
||
|
0xa0, 0x00, 0x00, 0xa3, 0x00, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */
|
||
|
0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
|
||
|
0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */
|
||
|
0x00, 0x00, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */
|
||
|
};
|
||
|
static const unsigned char iso8859_7_page03[88] = {
|
||
|
0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0x00, /* 0x80-0x87 */
|
||
|
0xb8, 0xb9, 0xba, 0x00, 0xbc, 0x00, 0xbe, 0xbf, /* 0x88-0x8f */
|
||
|
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x90-0x97 */
|
||
|
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x98-0x9f */
|
||
|
0xd0, 0xd1, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xa0-0xa7 */
|
||
|
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xa8-0xaf */
|
||
|
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xb0-0xb7 */
|
||
|
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xb8-0xbf */
|
||
|
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xc0-0xc7 */
|
||
|
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xc8-0xcf */
|
||
|
};
|
||
|
static const unsigned char iso8859_7_page20[16] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
|
||
|
};
|
||
|
|
||
|
/* ECI 9 ISO/IEC 8859-7 Latin/Greek */
|
||
|
static int iso8859_7_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00a0) {
|
||
|
if (wc >= 0x0080) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x00c0) {
|
||
|
c = iso8859_7_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x0378 && wc < 0x03d0) {
|
||
|
c = iso8859_7_page03[wc-0x0378];
|
||
|
} else if (wc >= 0x2010 && wc < 0x2020) {
|
||
|
c = iso8859_7_page20[wc-0x2010];
|
||
|
} else if (wc == 0x20ac) {
|
||
|
c = 0xa4;
|
||
|
} else if (wc == 0x20af) {
|
||
|
c = 0xa5;
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-8 (libiconv-1.16/lib/iso8859_8.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_8_page00[88] = {
|
||
|
0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
|
||
|
0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
|
||
|
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
|
||
|
0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, /* 0xd0-0xd7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */
|
||
|
};
|
||
|
static const unsigned char iso8859_8_page05[32] = {
|
||
|
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xd0-0xd7 */
|
||
|
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xd8-0xdf */
|
||
|
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xe0-0xe7 */
|
||
|
0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
|
||
|
};
|
||
|
static const unsigned char iso8859_8_page20[16] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x10-0x17 */
|
||
|
};
|
||
|
|
||
|
/* ECI 10 ISO/IEC 8859-8 Latin/Hebrew */
|
||
|
static int iso8859_8_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00a0) {
|
||
|
if (wc >= 0x0080) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x00f8) {
|
||
|
c = iso8859_8_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x05d0 && wc < 0x05f0) {
|
||
|
c = iso8859_8_page05[wc-0x05d0];
|
||
|
} else if (wc >= 0x2008 && wc < 0x2018) {
|
||
|
c = iso8859_8_page20[wc-0x2008];
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-9 (libiconv-1.16/lib/iso8859_9.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_9_page00[48] = {
|
||
|
0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
|
||
|
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */
|
||
|
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
|
||
|
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
|
||
|
0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
|
||
|
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */
|
||
|
};
|
||
|
static const unsigned char iso8859_9_page01[72] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, /* 0x18-0x1f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */
|
||
|
0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, /* 0x58-0x5f */
|
||
|
};
|
||
|
|
||
|
/* ECI 11 ISO/IEC 8859-9 Latin alphabet No. 5 (Latin-5) (Latin/Turkish) */
|
||
|
static int iso8859_9_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00d0) {
|
||
|
if (wc >= 0x0080 && wc < 0x00a0) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x0100) {
|
||
|
c = iso8859_9_page00[wc-0x00d0];
|
||
|
} else if (wc >= 0x0118 && wc < 0x0160) {
|
||
|
c = iso8859_9_page01[wc-0x0118];
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-10 (libiconv-1.16/lib/iso8859_10.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_10_page00[224] = {
|
||
|
0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
|
||
|
0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
|
||
|
0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00, /* 0xc0-0xc7 */
|
||
|
0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
|
||
|
0xd0, 0x00, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, /* 0xd0-0xd7 */
|
||
|
0xd8, 0x00, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */
|
||
|
0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */
|
||
|
0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0xef, /* 0xe8-0xef */
|
||
|
0xf0, 0x00, 0x00, 0xf3, 0xf4, 0xf5, 0xf6, 0x00, /* 0xf0-0xf7 */
|
||
|
0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */
|
||
|
/* 0x0100 */
|
||
|
0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00, /* 0x00-0x07 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */
|
||
|
0xa9, 0xb9, 0xa2, 0xb2, 0x00, 0x00, 0xcc, 0xec, /* 0x10-0x17 */
|
||
|
0xca, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
|
||
|
0x00, 0x00, 0xa3, 0xb3, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
|
||
|
0xa5, 0xb5, 0xa4, 0xb4, 0x00, 0x00, 0xc7, 0xe7, /* 0x28-0x2f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0xb6, /* 0x30-0x37 */
|
||
|
0xff, 0x00, 0x00, 0xa8, 0xb8, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf1, 0x00, /* 0x40-0x47 */
|
||
|
0x00, 0x00, 0xaf, 0xbf, 0xd2, 0xf2, 0x00, 0x00, /* 0x48-0x4f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
|
||
|
0xaa, 0xba, 0x00, 0x00, 0x00, 0x00, 0xab, 0xbb, /* 0x60-0x67 */
|
||
|
0xd7, 0xf7, 0xae, 0xbe, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
|
||
|
0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc, 0x00, /* 0x78-0x7f */
|
||
|
};
|
||
|
|
||
|
/* ECI 12 ISO/IEC 8859-10 Latin alphabet No. 6 (Latin-6) (Nordic) */
|
||
|
static int iso8859_10_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00a0) {
|
||
|
if (wc >= 0x0080) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x0180) {
|
||
|
c = iso8859_10_page00[wc-0x00a0];
|
||
|
} else if (wc == 0x2015) {
|
||
|
c = 0xbd;
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-11 (libiconv-1.16/lib/iso8859_11.h)
|
||
|
*/
|
||
|
|
||
|
/* ECI 13 ISO/IEC 8859-11 Latin/Thai */
|
||
|
static int iso8859_11_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
if (wc < 0x00a1) {
|
||
|
if (wc >= 0x0080 && wc < 0x00a0) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc >= 0x0e01 && wc <= 0x0e5b && !(wc >= 0x0e3b && wc <= 0x0e3e)) {
|
||
|
*r = (unsigned char) (wc - 0x0d60);
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-13 (libiconv-1.16/lib/iso8859_13.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_13_page00[224] = {
|
||
|
0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */
|
||
|
0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */
|
||
|
0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
|
||
|
0x00, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xc4, 0xc5, 0xaf, 0x00, /* 0xc0-0xc7 */
|
||
|
0x00, 0xc9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
|
||
|
0x00, 0x00, 0x00, 0xd3, 0x00, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */
|
||
|
0xa8, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xe4, 0xe5, 0xbf, 0x00, /* 0xe0-0xe7 */
|
||
|
0x00, 0xe9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */
|
||
|
0x00, 0x00, 0x00, 0xf3, 0x00, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */
|
||
|
0xb8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */
|
||
|
/* 0x0100 */
|
||
|
0xc2, 0xe2, 0x00, 0x00, 0xc0, 0xe0, 0xc3, 0xe3, /* 0x00-0x07 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */
|
||
|
0x00, 0x00, 0xc7, 0xe7, 0x00, 0x00, 0xcb, 0xeb, /* 0x10-0x17 */
|
||
|
0xc6, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
|
||
|
0x00, 0x00, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
|
||
|
0x00, 0x00, 0xce, 0xee, 0x00, 0x00, 0xc1, 0xe1, /* 0x28-0x2f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xed, /* 0x30-0x37 */
|
||
|
0x00, 0x00, 0x00, 0xcf, 0xef, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
0x00, 0xd9, 0xf9, 0xd1, 0xf1, 0xd2, 0xf2, 0x00, /* 0x40-0x47 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xd4, 0xf4, 0x00, 0x00, /* 0x48-0x4f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xba, /* 0x50-0x57 */
|
||
|
0x00, 0x00, 0xda, 0xfa, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
|
||
|
0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
|
||
|
0x00, 0x00, 0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
|
||
|
0x00, 0x00, 0xd8, 0xf8, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0x00, 0xca, 0xea, 0xdd, 0xfd, 0xde, 0xfe, 0x00, /* 0x78-0x7f */
|
||
|
};
|
||
|
static const unsigned char iso8859_13_page20[8] = {
|
||
|
0x00, 0xff, 0x00, 0x00, 0xb4, 0xa1, 0xa5, 0x00, /* 0x18-0x1f */
|
||
|
};
|
||
|
|
||
|
/* ECI 15 ISO/IEC 8859-13 Latin alphabet No. 7 (Latin-7) (Baltic Rim) */
|
||
|
static int iso8859_13_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00a0) {
|
||
|
if (wc >= 0x0080) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x0180) {
|
||
|
c = iso8859_13_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x2018 && wc < 0x2020) {
|
||
|
c = iso8859_13_page20[wc-0x2018];
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-14 (libiconv-1.16/lib/iso8859_14.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_14_page00[96] = {
|
||
|
0xa0, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */
|
||
|
0x00, 0xa9, 0x00, 0x00, 0x00, 0xad, 0xae, 0x00, /* 0xa8-0xaf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00, /* 0xb0-0xb7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
|
||
|
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */
|
||
|
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
|
||
|
0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, /* 0xd0-0xd7 */
|
||
|
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */
|
||
|
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */
|
||
|
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
|
||
|
0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x00, /* 0xf0-0xf7 */
|
||
|
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0x00, 0xff, /* 0xf8-0xff */
|
||
|
};
|
||
|
static const unsigned char iso8859_14_page01_0[32] = {
|
||
|
0x00, 0x00, 0xa4, 0xa5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
|
||
|
0xb2, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
|
||
|
};
|
||
|
static const unsigned char iso8859_14_page01_1[16] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, 0xde, 0xfe, /* 0x70-0x77 */
|
||
|
0xaf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */
|
||
|
};
|
||
|
static const unsigned char iso8859_14_page1e_0[136] = {
|
||
|
0x00, 0x00, 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */
|
||
|
0x00, 0x00, 0xa6, 0xab, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xb1, /* 0x18-0x1f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
0xb4, 0xb5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, 0xb9, /* 0x50-0x57 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
|
||
|
0xbb, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
|
||
|
0x00, 0x00, 0xd7, 0xf7, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */
|
||
|
0xa8, 0xb8, 0xaa, 0xba, 0xbd, 0xbe, 0x00, 0x00, /* 0x80-0x87 */
|
||
|
};
|
||
|
static const unsigned char iso8859_14_page1e_1[8] = {
|
||
|
0x00, 0x00, 0xac, 0xbc, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */
|
||
|
};
|
||
|
|
||
|
/* ECI 16 ISO/IEC 8859-14 Latin alphabet No. 8 (Latin-8) (Celtic) */
|
||
|
static int iso8859_14_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00a0) {
|
||
|
if (wc >= 0x0080) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x0100) {
|
||
|
c = iso8859_14_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x0108 && wc < 0x0128) {
|
||
|
c = iso8859_14_page01_0[wc-0x0108];
|
||
|
} else if (wc >= 0x0170 && wc < 0x0180) {
|
||
|
c = iso8859_14_page01_1[wc-0x0170];
|
||
|
} else if (wc >= 0x1e00 && wc < 0x1e88) {
|
||
|
c = iso8859_14_page1e_0[wc-0x1e00];
|
||
|
} else if (wc >= 0x1ef0 && wc < 0x1ef8) {
|
||
|
c = iso8859_14_page1e_1[wc-0x1ef0];
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-15 (libiconv-1.16/lib/iso8859_15.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_15_page00[32] = {
|
||
|
0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0x00, 0xa7, /* 0xa0-0xa7 */
|
||
|
0x00, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
|
||
|
0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
|
||
|
0x00, 0xb9, 0xba, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0xb8-0xbf */
|
||
|
};
|
||
|
static const unsigned char iso8859_15_page01[48] = {
|
||
|
0x00, 0x00, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
|
||
|
0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0xbe, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */
|
||
|
};
|
||
|
|
||
|
/* ECI 17 ISO/IEC 8859-15 Latin alphabet No. 9 (Latin-9) */
|
||
|
static int iso8859_15_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00a0) {
|
||
|
if (wc >= 0x0080) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x00c0) {
|
||
|
c = iso8859_15_page00[wc-0x00a0];
|
||
|
} else if (wc < 0x0100) {
|
||
|
c = wc;
|
||
|
} else if (wc >= 0x0150 && wc < 0x0180) {
|
||
|
c = iso8859_15_page01[wc-0x0150];
|
||
|
} else if (wc == 0x20ac) {
|
||
|
c = 0xa4;
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* ISO-8859-16 (libiconv-1.16/lib/iso8859_16.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char iso8859_16_page00[224] = {
|
||
|
0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */
|
||
|
0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
|
||
|
0xb0, 0xb1, 0x00, 0x00, 0x00, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */
|
||
|
0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
|
||
|
0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0xc6, 0xc7, /* 0xc0-0xc7 */
|
||
|
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */
|
||
|
0x00, 0x00, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0x00, /* 0xd0-0xd7 */
|
||
|
0x00, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */
|
||
|
0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0xe7, /* 0xe0-0xe7 */
|
||
|
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */
|
||
|
0x00, 0x00, 0xf2, 0xf3, 0xf4, 0x00, 0xf6, 0x00, /* 0xf0-0xf7 */
|
||
|
0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */
|
||
|
/* 0x0100 */
|
||
|
0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xa2, 0xc5, 0xe5, /* 0x00-0x07 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xb2, 0xb9, 0x00, 0x00, /* 0x08-0x0f */
|
||
|
0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0x00, /* 0x40-0x47 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */
|
||
|
0xd5, 0xf5, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
|
||
|
0x00, 0x00, 0xd7, 0xf7, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
|
||
|
0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
|
||
|
0xd8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0xbe, 0xac, 0xae, 0xaf, 0xbf, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */
|
||
|
};
|
||
|
static const unsigned char iso8859_16_page02[8] = {
|
||
|
0xaa, 0xba, 0xde, 0xfe, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
|
||
|
};
|
||
|
static const unsigned char iso8859_16_page20[8] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0xa5, 0x00, /* 0x18-0x1f */
|
||
|
};
|
||
|
|
||
|
/* ECI 18 ISO/IEC 8859-16 Latin alphabet No. 10 (Latin-10) (South-Eastern European) */
|
||
|
static int iso8859_16_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x00a0) {
|
||
|
if (wc >= 0x0080) { /* U+0080-9F fail */
|
||
|
return 0;
|
||
|
}
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc < 0x0180) {
|
||
|
c = iso8859_16_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x0218 && wc < 0x0220) {
|
||
|
c = iso8859_16_page02[wc-0x0218];
|
||
|
} else if (wc >= 0x2018 && wc < 0x2020) {
|
||
|
c = iso8859_16_page20[wc-0x2018];
|
||
|
} else if (wc == 0x20ac) {
|
||
|
c = 0xa4;
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* CP1250 (libiconv-1.16/lib/cp1250.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char cp1250_page00[224] = {
|
||
|
0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */
|
||
|
0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */
|
||
|
0xb0, 0xb1, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
|
||
|
0xb8, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
|
||
|
0x00, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7, /* 0xc0-0xc7 */
|
||
|
0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00, /* 0xc8-0xcf */
|
||
|
0x00, 0x00, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */
|
||
|
0x00, 0x00, 0xda, 0x00, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */
|
||
|
0x00, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */
|
||
|
0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00, /* 0xe8-0xef */
|
||
|
0x00, 0x00, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */
|
||
|
0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */
|
||
|
/* 0x0100 */
|
||
|
0x00, 0x00, 0xc3, 0xe3, 0xa5, 0xb9, 0xc6, 0xe6, /* 0x00-0x07 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */
|
||
|
0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0xca, 0xea, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
|
||
|
0x00, 0xc5, 0xe5, 0x00, 0x00, 0xbc, 0xbe, 0x00, /* 0x38-0x3f */
|
||
|
0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0xd2, /* 0x40-0x47 */
|
||
|
0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */
|
||
|
0xd5, 0xf5, 0x00, 0x00, 0xc0, 0xe0, 0x00, 0x00, /* 0x50-0x57 */
|
||
|
0xd8, 0xf8, 0x8c, 0x9c, 0x00, 0x00, 0xaa, 0xba, /* 0x58-0x5f */
|
||
|
0x8a, 0x9a, 0xde, 0xfe, 0x8d, 0x9d, 0x00, 0x00, /* 0x60-0x67 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd9, 0xf9, /* 0x68-0x6f */
|
||
|
0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0x00, 0x8f, 0x9f, 0xaf, 0xbf, 0x8e, 0x9e, 0x00, /* 0x78-0x7f */
|
||
|
};
|
||
|
static const unsigned char cp1250_page02[32] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, /* 0xc0-0xc7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
|
||
|
0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */
|
||
|
};
|
||
|
static const unsigned char cp1250_page20[48] = {
|
||
|
0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */
|
||
|
0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */
|
||
|
0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
|
||
|
0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
};
|
||
|
|
||
|
/* ECI 21 Windows-1250 Latin 2 (Central Europe) */
|
||
|
static int cp1250_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x0080) {
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc >= 0x00a0 && wc < 0x0180) {
|
||
|
c = cp1250_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x02c0 && wc < 0x02e0) {
|
||
|
c = cp1250_page02[wc-0x02c0];
|
||
|
} else if (wc >= 0x2010 && wc < 0x2040) {
|
||
|
c = cp1250_page20[wc-0x2010];
|
||
|
} else if (wc == 0x20ac) {
|
||
|
c = 0x80;
|
||
|
} else if (wc == 0x2122) {
|
||
|
c = 0x99;
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* CP1251 (libiconv-1.16/lib/cp1251.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char cp1251_page00[32] = {
|
||
|
0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */
|
||
|
0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */
|
||
|
0xb0, 0xb1, 0x00, 0x00, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
|
||
|
0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
|
||
|
};
|
||
|
static const unsigned char cp1251_page04[152] = {
|
||
|
0x00, 0xa8, 0x80, 0x81, 0xaa, 0xbd, 0xb2, 0xaf, /* 0x00-0x07 */
|
||
|
0xa3, 0x8a, 0x8c, 0x8e, 0x8d, 0x00, 0xa1, 0x8f, /* 0x08-0x0f */
|
||
|
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x10-0x17 */
|
||
|
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x18-0x1f */
|
||
|
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x20-0x27 */
|
||
|
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x28-0x2f */
|
||
|
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x30-0x37 */
|
||
|
0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x38-0x3f */
|
||
|
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x40-0x47 */
|
||
|
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0x48-0x4f */
|
||
|
0x00, 0xb8, 0x90, 0x83, 0xba, 0xbe, 0xb3, 0xbf, /* 0x50-0x57 */
|
||
|
0xbc, 0x9a, 0x9c, 0x9e, 0x9d, 0x00, 0xa2, 0x9f, /* 0x58-0x5f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
|
||
|
0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
|
||
|
};
|
||
|
static const unsigned char cp1251_page20[48] = {
|
||
|
0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */
|
||
|
0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */
|
||
|
0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
|
||
|
0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
};
|
||
|
|
||
|
/* ECI 22 Windows-1251 Cyrillic */
|
||
|
static int cp1251_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x0080) {
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc >= 0x00a0 && wc < 0x00c0) {
|
||
|
c = cp1251_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x0400 && wc < 0x0498) {
|
||
|
c = cp1251_page04[wc-0x0400];
|
||
|
} else if (wc >= 0x2010 && wc < 0x2040) {
|
||
|
c = cp1251_page20[wc-0x2010];
|
||
|
} else if (wc == 0x20ac) {
|
||
|
c = 0x88;
|
||
|
} else if (wc == 0x2116) {
|
||
|
c = 0xb9;
|
||
|
} else if (wc == 0x2122) {
|
||
|
c = 0x99;
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* CP1252 (libiconv-1.16/lib/cp1252.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char cp1252_page01[72] = {
|
||
|
0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
|
||
|
0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0x9f, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x9e, 0x00, /* 0x78-0x7f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
|
||
|
0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
|
||
|
};
|
||
|
static const unsigned char cp1252_page02[32] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
|
||
|
};
|
||
|
static const unsigned char cp1252_page20[48] = {
|
||
|
0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */
|
||
|
0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */
|
||
|
0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
|
||
|
0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
};
|
||
|
|
||
|
/* ECI 23 Windows-1252 Latin 1 */
|
||
|
static int cp1252_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x0080) {
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc >= 0x00a0 && wc < 0x0100) {
|
||
|
c = wc;
|
||
|
} else if (wc >= 0x0150 && wc < 0x0198) {
|
||
|
c = cp1252_page01[wc-0x0150];
|
||
|
} else if (wc >= 0x02c0 && wc < 0x02e0) {
|
||
|
c = cp1252_page02[wc-0x02c0];
|
||
|
} else if (wc >= 0x2010 && wc < 0x2040) {
|
||
|
c = cp1252_page20[wc-0x2010];
|
||
|
} else if (wc == 0x20ac) {
|
||
|
c = 0x80;
|
||
|
} else if (wc == 0x2122) {
|
||
|
c = 0x99;
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* CP1256 (libiconv-1.16/lib/cp1256.h)
|
||
|
*/
|
||
|
|
||
|
static const unsigned char cp1256_page00[96] = {
|
||
|
0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */
|
||
|
0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */
|
||
|
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */
|
||
|
0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7, /* 0xd0-0xd7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */
|
||
|
0xe0, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */
|
||
|
0xe8, 0xe9, 0xea, 0xeb, 0x00, 0x00, 0xee, 0xef, /* 0xe8-0xef */
|
||
|
0x00, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */
|
||
|
0x00, 0xf9, 0x00, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */
|
||
|
};
|
||
|
static const unsigned char cp1256_page01[72] = {
|
||
|
0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
|
||
|
0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
|
||
|
};
|
||
|
static const unsigned char cp1256_page06[208] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, /* 0x08-0x0f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */
|
||
|
0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */
|
||
|
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */
|
||
|
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd8, /* 0x30-0x37 */
|
||
|
0xd9, 0xda, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
0xdc, 0xdd, 0xde, 0xdf, 0xe1, 0xe3, 0xe4, 0xe5, /* 0x40-0x47 */
|
||
|
0xe6, 0xec, 0xed, 0xf0, 0xf1, 0xf2, 0xf3, 0xf5, /* 0x48-0x4f */
|
||
|
0xf6, 0xf8, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */
|
||
|
0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, /* 0x78-0x7f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, /* 0x80-0x87 */
|
||
|
0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
|
||
|
0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */
|
||
|
0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
|
||
|
0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0xa8-0xaf */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
|
||
|
0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0xaa, 0x00, /* 0xb8-0xbf */
|
||
|
0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */
|
||
|
0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */
|
||
|
};
|
||
|
static const unsigned char cp1256_page20[56] = {
|
||
|
0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0xfd, 0xfe, /* 0x08-0x0f */
|
||
|
0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */
|
||
|
0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */
|
||
|
0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */
|
||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */
|
||
|
0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */
|
||
|
0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */
|
||
|
};
|
||
|
|
||
|
/* ECI 24 Windows-1256 Arabic */
|
||
|
static int cp1256_wctosb(unsigned char *r, const unsigned int wc) {
|
||
|
unsigned char c = 0;
|
||
|
if (wc < 0x0080) {
|
||
|
*r = (unsigned char) wc;
|
||
|
return 1;
|
||
|
}
|
||
|
if (wc >= 0x00a0 && wc < 0x0100) {
|
||
|
c = cp1256_page00[wc-0x00a0];
|
||
|
} else if (wc >= 0x0150 && wc < 0x0198) {
|
||
|
c = cp1256_page01[wc-0x0150];
|
||
|
} else if (wc == 0x02c6) {
|
||
|
c = 0x88;
|
||
|
} else if (wc >= 0x0608 && wc < 0x06d8) {
|
||
|
c = cp1256_page06[wc-0x0608];
|
||
|
} else if (wc >= 0x2008 && wc < 0x2040) {
|
||
|
c = cp1256_page20[wc-0x2008];
|
||
|
} else if (wc == 0x20ac) {
|
||
|
c = 0x80;
|
||
|
} else if (wc == 0x2122) {
|
||
|
c = 0x99;
|
||
|
}
|
||
|
if (c != 0) {
|
||
|
*r = c;
|
||
|
return 1;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* UCS-2 (libiconv-1.16/lib/ucs2.h)
|
||
|
*/
|
||
|
|
||
|
/* ECI 25 UC2-2 Big Endian (ISO/IEC 10646) */
|
||
|
static int ucs2be_wctomb(unsigned char *r, const unsigned int wc) {
|
||
|
if (wc < 0x10000 && wc != 0xfffe && !(wc >= 0xd800 && wc < 0xe000)) {
|
||
|
r[0] = (unsigned char) (wc >> 8);
|
||
|
r[1] = (unsigned char) (wc & 0xff);
|
||
|
return 2;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
#endif /* ECI_SB_H */
|