xref: /webtrees/app/Encodings/Windows1250.php (revision 1c6adce825f16611bd8b75a22114302de4b41cfe)
1*1c6adce8SGreg Roach<?php
2*1c6adce8SGreg Roach
3*1c6adce8SGreg Roach/**
4*1c6adce8SGreg Roach * webtrees: online genealogy
5*1c6adce8SGreg Roach * Copyright (C) 2021 webtrees development team
6*1c6adce8SGreg Roach * This program is free software: you can redistribute it and/or modify
7*1c6adce8SGreg Roach * it under the terms of the GNU General Public License as published by
8*1c6adce8SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9*1c6adce8SGreg Roach * (at your option) any later version.
10*1c6adce8SGreg Roach * This program is distributed in the hope that it will be useful,
11*1c6adce8SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*1c6adce8SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*1c6adce8SGreg Roach * GNU General Public License for more details.
14*1c6adce8SGreg Roach * You should have received a copy of the GNU General Public License
15*1c6adce8SGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16*1c6adce8SGreg Roach */
17*1c6adce8SGreg Roach
18*1c6adce8SGreg Roachdeclare(strict_types=1);
19*1c6adce8SGreg Roach
20*1c6adce8SGreg Roachnamespace Fisharebest\Webtrees\Encodings;
21*1c6adce8SGreg Roach
22*1c6adce8SGreg Roach/**
23*1c6adce8SGreg Roach * Convert between Windows Code Page 1250 and UTF-8.
24*1c6adce8SGreg Roach *
25*1c6adce8SGreg Roach * @link https://en.wikipedia.org/wiki/Windows-1250
26*1c6adce8SGreg Roach */
27*1c6adce8SGreg Roachclass Windows1250 extends AbstractEncoding
28*1c6adce8SGreg Roach{
29*1c6adce8SGreg Roach    public const NAME = 'CP1250';
30*1c6adce8SGreg Roach
31*1c6adce8SGreg Roach    protected const TO_UTF8 = [
32*1c6adce8SGreg Roach        "\x80" => UTF8::EURO_SIGN,
33*1c6adce8SGreg Roach        "\x81" => UTF8::REPLACEMENT_CHARACTER,
34*1c6adce8SGreg Roach        "\x82" => UTF8::SINGLE_LOW_9_QUOTATION_MARK,
35*1c6adce8SGreg Roach        "\x83" => UTF8::REPLACEMENT_CHARACTER,
36*1c6adce8SGreg Roach        "\x84" => UTF8::DOUBLE_LOW_9_QUOTATION_MARK,
37*1c6adce8SGreg Roach        "\x85" => UTF8::HORIZONTAL_ELLIPSIS,
38*1c6adce8SGreg Roach        "\x86" => UTF8::DAGGER,
39*1c6adce8SGreg Roach        "\x87" => UTF8::DOUBLE_DAGGER,
40*1c6adce8SGreg Roach        "\x88" => UTF8::REPLACEMENT_CHARACTER,
41*1c6adce8SGreg Roach        "\x89" => UTF8::PER_MILLE_SIGN,
42*1c6adce8SGreg Roach        "\x8A" => UTF8::LATIN_CAPITAL_LETTER_S_WITH_CARON,
43*1c6adce8SGreg Roach        "\x8B" => UTF8::SINGLE_LEFT_POINTING_ANGLE_QUOTATION_MARK,
44*1c6adce8SGreg Roach        "\x8C" => UTF8::LATIN_CAPITAL_LETTER_S_WITH_ACUTE,
45*1c6adce8SGreg Roach        "\x8D" => UTF8::LATIN_CAPITAL_LETTER_T_WITH_CARON,
46*1c6adce8SGreg Roach        "\x8E" => UTF8::LATIN_CAPITAL_LETTER_Z_WITH_CARON,
47*1c6adce8SGreg Roach        "\x8F" => UTF8::LATIN_CAPITAL_LETTER_Z_WITH_ACUTE,
48*1c6adce8SGreg Roach        "\x90" => UTF8::REPLACEMENT_CHARACTER,
49*1c6adce8SGreg Roach        "\x91" => UTF8::LEFT_SINGLE_QUOTATION_MARK,
50*1c6adce8SGreg Roach        "\x92" => UTF8::RIGHT_SINGLE_QUOTATION_MARK,
51*1c6adce8SGreg Roach        "\x93" => UTF8::LEFT_DOUBLE_QUOTATION_MARK,
52*1c6adce8SGreg Roach        "\x94" => UTF8::RIGHT_DOUBLE_QUOTATION_MARK,
53*1c6adce8SGreg Roach        "\x95" => UTF8::BULLET,
54*1c6adce8SGreg Roach        "\x96" => UTF8::EN_DASH,
55*1c6adce8SGreg Roach        "\x97" => UTF8::EM_DASH,
56*1c6adce8SGreg Roach        "\x98" => UTF8::REPLACEMENT_CHARACTER,
57*1c6adce8SGreg Roach        "\x99" => UTF8::TRADE_MARK_SIGN,
58*1c6adce8SGreg Roach        "\x9A" => UTF8::LATIN_SMALL_LETTER_S_WITH_CARON,
59*1c6adce8SGreg Roach        "\x9B" => UTF8::SINGLE_RIGHT_POINTING_ANGLE_QUOTATION_MARK,
60*1c6adce8SGreg Roach        "\x9C" => UTF8::LATIN_SMALL_LETTER_S_WITH_ACUTE,
61*1c6adce8SGreg Roach        "\x9D" => UTF8::LATIN_SMALL_LETTER_T_WITH_CARON,
62*1c6adce8SGreg Roach        "\x9E" => UTF8::LATIN_SMALL_LETTER_Z_WITH_CARON,
63*1c6adce8SGreg Roach        "\x9F" => UTF8::LATIN_SMALL_LETTER_Z_WITH_ACUTE,
64*1c6adce8SGreg Roach        "\xA0" => UTF8::NO_BREAK_SPACE,
65*1c6adce8SGreg Roach        "\xA1" => UTF8::CARON,
66*1c6adce8SGreg Roach        "\xA2" => UTF8::BREVE,
67*1c6adce8SGreg Roach        "\xA3" => UTF8::LATIN_CAPITAL_LETTER_L_WITH_STROKE,
68*1c6adce8SGreg Roach        "\xA4" => UTF8::CURRENCY_SIGN,
69*1c6adce8SGreg Roach        "\xA5" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_OGONEK,
70*1c6adce8SGreg Roach        "\xA6" => UTF8::BROKEN_BAR,
71*1c6adce8SGreg Roach        "\xA7" => UTF8::SECTION_SIGN,
72*1c6adce8SGreg Roach        "\xA8" => UTF8::DIAERESIS,
73*1c6adce8SGreg Roach        "\xA9" => UTF8::COPYRIGHT_SIGN,
74*1c6adce8SGreg Roach        "\xAA" => UTF8::LATIN_CAPITAL_LETTER_S_WITH_CEDILLA,
75*1c6adce8SGreg Roach        "\xAB" => UTF8::LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK,
76*1c6adce8SGreg Roach        "\xAC" => UTF8::NOT_SIGN,
77*1c6adce8SGreg Roach        "\xAD" => UTF8::SOFT_HYPHEN,
78*1c6adce8SGreg Roach        "\xAE" => UTF8::REGISTERED_SIGN,
79*1c6adce8SGreg Roach        "\xAF" => UTF8::LATIN_CAPITAL_LETTER_Z_WITH_DOT_ABOVE,
80*1c6adce8SGreg Roach        "\xB0" => UTF8::DEGREE_SIGN,
81*1c6adce8SGreg Roach        "\xB1" => UTF8::PLUS_MINUS_SIGN,
82*1c6adce8SGreg Roach        "\xB2" => UTF8::OGONEK,
83*1c6adce8SGreg Roach        "\xB3" => UTF8::LATIN_SMALL_LETTER_L_WITH_STROKE,
84*1c6adce8SGreg Roach        "\xB4" => UTF8::ACUTE_ACCENT,
85*1c6adce8SGreg Roach        "\xB5" => UTF8::MICRO_SIGN,
86*1c6adce8SGreg Roach        "\xB6" => UTF8::PILCROW_SIGN,
87*1c6adce8SGreg Roach        "\xB7" => UTF8::MIDDLE_DOT,
88*1c6adce8SGreg Roach        "\xB8" => UTF8::CEDILLA,
89*1c6adce8SGreg Roach        "\xB9" => UTF8::LATIN_SMALL_LETTER_A_WITH_OGONEK,
90*1c6adce8SGreg Roach        "\xBA" => UTF8::LATIN_SMALL_LETTER_S_WITH_CEDILLA,
91*1c6adce8SGreg Roach        "\xBB" => UTF8::RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK,
92*1c6adce8SGreg Roach        "\xBC" => UTF8::LATIN_CAPITAL_LETTER_L_WITH_CARON,
93*1c6adce8SGreg Roach        "\xBD" => UTF8::DOUBLE_ACUTE_ACCENT,
94*1c6adce8SGreg Roach        "\xBE" => UTF8::LATIN_SMALL_LETTER_L_WITH_CARON,
95*1c6adce8SGreg Roach        "\xBF" => UTF8::LATIN_SMALL_LETTER_Z_WITH_DOT_ABOVE,
96*1c6adce8SGreg Roach        "\xC0" => UTF8::LATIN_CAPITAL_LETTER_R_WITH_ACUTE,
97*1c6adce8SGreg Roach        "\xC1" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_ACUTE,
98*1c6adce8SGreg Roach        "\xC2" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_CIRCUMFLEX,
99*1c6adce8SGreg Roach        "\xC3" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_BREVE,
100*1c6adce8SGreg Roach        "\xC4" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS,
101*1c6adce8SGreg Roach        "\xC5" => UTF8::LATIN_CAPITAL_LETTER_L_WITH_ACUTE,
102*1c6adce8SGreg Roach        "\xC6" => UTF8::LATIN_CAPITAL_LETTER_C_WITH_ACUTE,
103*1c6adce8SGreg Roach        "\xC7" => UTF8::LATIN_CAPITAL_LETTER_C_WITH_CEDILLA,
104*1c6adce8SGreg Roach        "\xC8" => UTF8::LATIN_CAPITAL_LETTER_C_WITH_CARON,
105*1c6adce8SGreg Roach        "\xC9" => UTF8::LATIN_CAPITAL_LETTER_E_WITH_ACUTE,
106*1c6adce8SGreg Roach        "\xCA" => UTF8::LATIN_CAPITAL_LETTER_E_WITH_OGONEK,
107*1c6adce8SGreg Roach        "\xCB" => UTF8::LATIN_CAPITAL_LETTER_E_WITH_DIAERESIS,
108*1c6adce8SGreg Roach        "\xCC" => UTF8::LATIN_CAPITAL_LETTER_E_WITH_CARON,
109*1c6adce8SGreg Roach        "\xCD" => UTF8::LATIN_CAPITAL_LETTER_I_WITH_ACUTE,
110*1c6adce8SGreg Roach        "\xCE" => UTF8::LATIN_CAPITAL_LETTER_I_WITH_CIRCUMFLEX,
111*1c6adce8SGreg Roach        "\xCF" => UTF8::LATIN_CAPITAL_LETTER_D_WITH_CARON,
112*1c6adce8SGreg Roach        "\xD0" => UTF8::LATIN_CAPITAL_LETTER_D_WITH_STROKE,
113*1c6adce8SGreg Roach        "\xD1" => UTF8::LATIN_CAPITAL_LETTER_N_WITH_ACUTE,
114*1c6adce8SGreg Roach        "\xD2" => UTF8::LATIN_CAPITAL_LETTER_N_WITH_CARON,
115*1c6adce8SGreg Roach        "\xD3" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_ACUTE,
116*1c6adce8SGreg Roach        "\xD4" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_CIRCUMFLEX,
117*1c6adce8SGreg Roach        "\xD5" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_DOUBLE_ACUTE,
118*1c6adce8SGreg Roach        "\xD6" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS,
119*1c6adce8SGreg Roach        "\xD7" => UTF8::MULTIPLICATION_SIGN,
120*1c6adce8SGreg Roach        "\xD8" => UTF8::LATIN_CAPITAL_LETTER_R_WITH_CARON,
121*1c6adce8SGreg Roach        "\xD9" => UTF8::LATIN_CAPITAL_LETTER_U_WITH_RING_ABOVE,
122*1c6adce8SGreg Roach        "\xDA" => UTF8::LATIN_CAPITAL_LETTER_U_WITH_ACUTE,
123*1c6adce8SGreg Roach        "\xDB" => UTF8::LATIN_CAPITAL_LETTER_U_WITH_DOUBLE_ACUTE,
124*1c6adce8SGreg Roach        "\xDC" => UTF8::LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS,
125*1c6adce8SGreg Roach        "\xDD" => UTF8::LATIN_CAPITAL_LETTER_Y_WITH_ACUTE,
126*1c6adce8SGreg Roach        "\xDE" => UTF8::LATIN_CAPITAL_LETTER_T_WITH_CEDILLA,
127*1c6adce8SGreg Roach        "\xDF" => UTF8::LATIN_SMALL_LETTER_SHARP_S,
128*1c6adce8SGreg Roach        "\xE0" => UTF8::LATIN_SMALL_LETTER_R_WITH_ACUTE,
129*1c6adce8SGreg Roach        "\xE1" => UTF8::LATIN_SMALL_LETTER_A_WITH_ACUTE,
130*1c6adce8SGreg Roach        "\xE2" => UTF8::LATIN_SMALL_LETTER_A_WITH_CIRCUMFLEX,
131*1c6adce8SGreg Roach        "\xE3" => UTF8::LATIN_SMALL_LETTER_A_WITH_BREVE,
132*1c6adce8SGreg Roach        "\xE4" => UTF8::LATIN_SMALL_LETTER_A_WITH_DIAERESIS,
133*1c6adce8SGreg Roach        "\xE5" => UTF8::LATIN_SMALL_LETTER_L_WITH_ACUTE,
134*1c6adce8SGreg Roach        "\xE6" => UTF8::LATIN_SMALL_LETTER_C_WITH_ACUTE,
135*1c6adce8SGreg Roach        "\xE7" => UTF8::LATIN_SMALL_LETTER_C_WITH_CEDILLA,
136*1c6adce8SGreg Roach        "\xE8" => UTF8::LATIN_SMALL_LETTER_C_WITH_CARON,
137*1c6adce8SGreg Roach        "\xE9" => UTF8::LATIN_SMALL_LETTER_E_WITH_ACUTE,
138*1c6adce8SGreg Roach        "\xEA" => UTF8::LATIN_SMALL_LETTER_E_WITH_OGONEK,
139*1c6adce8SGreg Roach        "\xEB" => UTF8::LATIN_SMALL_LETTER_E_WITH_DIAERESIS,
140*1c6adce8SGreg Roach        "\xEC" => UTF8::LATIN_SMALL_LETTER_E_WITH_CARON,
141*1c6adce8SGreg Roach        "\xED" => UTF8::LATIN_SMALL_LETTER_I_WITH_ACUTE,
142*1c6adce8SGreg Roach        "\xEE" => UTF8::LATIN_SMALL_LETTER_I_WITH_CIRCUMFLEX,
143*1c6adce8SGreg Roach        "\xEF" => UTF8::LATIN_SMALL_LETTER_D_WITH_CARON,
144*1c6adce8SGreg Roach        "\xF0" => UTF8::LATIN_SMALL_LETTER_D_WITH_STROKE,
145*1c6adce8SGreg Roach        "\xF1" => UTF8::LATIN_SMALL_LETTER_N_WITH_ACUTE,
146*1c6adce8SGreg Roach        "\xF2" => UTF8::LATIN_SMALL_LETTER_N_WITH_CARON,
147*1c6adce8SGreg Roach        "\xF3" => UTF8::LATIN_SMALL_LETTER_O_WITH_ACUTE,
148*1c6adce8SGreg Roach        "\xF4" => UTF8::LATIN_SMALL_LETTER_O_WITH_CIRCUMFLEX,
149*1c6adce8SGreg Roach        "\xF5" => UTF8::LATIN_SMALL_LETTER_O_WITH_DOUBLE_ACUTE,
150*1c6adce8SGreg Roach        "\xF6" => UTF8::LATIN_SMALL_LETTER_O_WITH_DIAERESIS,
151*1c6adce8SGreg Roach        "\xF7" => UTF8::DIVISION_SIGN,
152*1c6adce8SGreg Roach        "\xF8" => UTF8::LATIN_SMALL_LETTER_R_WITH_CARON,
153*1c6adce8SGreg Roach        "\xF9" => UTF8::LATIN_SMALL_LETTER_U_WITH_RING_ABOVE,
154*1c6adce8SGreg Roach        "\xFA" => UTF8::LATIN_SMALL_LETTER_U_WITH_ACUTE,
155*1c6adce8SGreg Roach        "\xFB" => UTF8::LATIN_SMALL_LETTER_U_WITH_DOUBLE_ACUTE,
156*1c6adce8SGreg Roach        "\xFC" => UTF8::LATIN_SMALL_LETTER_U_WITH_DIAERESIS,
157*1c6adce8SGreg Roach        "\xFD" => UTF8::LATIN_SMALL_LETTER_Y_WITH_ACUTE,
158*1c6adce8SGreg Roach        "\xFE" => UTF8::LATIN_SMALL_LETTER_T_WITH_CEDILLA,
159*1c6adce8SGreg Roach        "\xFF" => UTF8::DOT_ABOVE,
160*1c6adce8SGreg Roach    ];
161*1c6adce8SGreg Roach}
162