xref: /webtrees/app/Encodings/CP850.php (revision d11be7027e34e3121be11cc025421873364403f9)
11c6adce8SGreg Roach<?php
21c6adce8SGreg Roach
31c6adce8SGreg Roach/**
41c6adce8SGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
61c6adce8SGreg Roach * This program is free software: you can redistribute it and/or modify
71c6adce8SGreg Roach * it under the terms of the GNU General Public License as published by
81c6adce8SGreg Roach * the Free Software Foundation, either version 3 of the License, or
91c6adce8SGreg Roach * (at your option) any later version.
101c6adce8SGreg Roach * This program is distributed in the hope that it will be useful,
111c6adce8SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
121c6adce8SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
131c6adce8SGreg Roach * GNU General Public License for more details.
141c6adce8SGreg Roach * You should have received a copy of the GNU General Public License
151c6adce8SGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
161c6adce8SGreg Roach */
171c6adce8SGreg Roach
181c6adce8SGreg Roachdeclare(strict_types=1);
191c6adce8SGreg Roach
201c6adce8SGreg Roachnamespace Fisharebest\Webtrees\Encodings;
211c6adce8SGreg Roach
221c6adce8SGreg Roach/**
231c6adce8SGreg Roach * Convert between UTF-8 and Windows Code Page 850.
241c6adce8SGreg Roach *
251c6adce8SGreg Roach * @link
261c6adce8SGreg Roach */
271c6adce8SGreg Roachclass CP850 extends AbstractEncoding
281c6adce8SGreg Roach{
291c6adce8SGreg Roach    public const NAME = 'CP850';
301c6adce8SGreg Roach
311c6adce8SGreg Roach    protected const TO_UTF8 = [
321c6adce8SGreg Roach        "\x80" => UTF8::LATIN_CAPITAL_LETTER_C_WITH_CEDILLA,
331c6adce8SGreg Roach        "\x81" => UTF8::LATIN_SMALL_LETTER_U_WITH_DIAERESIS,
341c6adce8SGreg Roach        "\x82" => UTF8::LATIN_SMALL_LETTER_E_WITH_ACUTE,
351c6adce8SGreg Roach        "\x83" => UTF8::LATIN_SMALL_LETTER_A_WITH_CIRCUMFLEX,
361c6adce8SGreg Roach        "\x84" => UTF8::LATIN_SMALL_LETTER_A_WITH_DIAERESIS,
371c6adce8SGreg Roach        "\x85" => UTF8::LATIN_SMALL_LETTER_A_WITH_GRAVE,
381c6adce8SGreg Roach        "\x86" => UTF8::LATIN_SMALL_LETTER_A_WITH_RING_ABOVE,
391c6adce8SGreg Roach        "\x87" => UTF8::LATIN_SMALL_LETTER_C_WITH_CEDILLA,
401c6adce8SGreg Roach        "\x88" => UTF8::LATIN_SMALL_LETTER_E_WITH_CIRCUMFLEX,
411c6adce8SGreg Roach        "\x89" => UTF8::LATIN_SMALL_LETTER_E_WITH_DIAERESIS,
421c6adce8SGreg Roach        "\x8A" => UTF8::LATIN_SMALL_LETTER_E_WITH_GRAVE,
431c6adce8SGreg Roach        "\x8B" => UTF8::LATIN_SMALL_LETTER_I_WITH_DIAERESIS,
441c6adce8SGreg Roach        "\x8C" => UTF8::LATIN_SMALL_LETTER_I_WITH_CIRCUMFLEX,
451c6adce8SGreg Roach        "\x8D" => UTF8::LATIN_SMALL_LETTER_I_WITH_GRAVE,
461c6adce8SGreg Roach        "\x8E" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS,
471c6adce8SGreg Roach        "\x8F" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE,
481c6adce8SGreg Roach        "\x90" => UTF8::LATIN_CAPITAL_LETTER_E_WITH_ACUTE,
491c6adce8SGreg Roach        "\x91" => UTF8::LATIN_SMALL_LETTER_AE,
501c6adce8SGreg Roach        "\x92" => UTF8::LATIN_CAPITAL_LETTER_AE,
511c6adce8SGreg Roach        "\x93" => UTF8::LATIN_SMALL_LETTER_O_WITH_CIRCUMFLEX,
521c6adce8SGreg Roach        "\x94" => UTF8::LATIN_SMALL_LETTER_O_WITH_DIAERESIS,
531c6adce8SGreg Roach        "\x95" => UTF8::LATIN_SMALL_LETTER_O_WITH_GRAVE,
541c6adce8SGreg Roach        "\x96" => UTF8::LATIN_SMALL_LETTER_U_WITH_CIRCUMFLEX,
551c6adce8SGreg Roach        "\x97" => UTF8::LATIN_SMALL_LETTER_U_WITH_GRAVE,
561c6adce8SGreg Roach        "\x98" => UTF8::LATIN_SMALL_LETTER_Y_WITH_DIAERESIS,
571c6adce8SGreg Roach        "\x99" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS,
581c6adce8SGreg Roach        "\x9A" => UTF8::LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS,
591c6adce8SGreg Roach        "\x9B" => UTF8::LATIN_SMALL_LETTER_O_WITH_STROKE,
601c6adce8SGreg Roach        "\x9C" => UTF8::POUND_SIGN,
611c6adce8SGreg Roach        "\x9D" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_STROKE,
621c6adce8SGreg Roach        "\x9E" => UTF8::MULTIPLICATION_SIGN,
631c6adce8SGreg Roach        "\x9F" => UTF8::LATIN_SMALL_LETTER_F_WITH_HOOK,
641c6adce8SGreg Roach        "\xA0" => UTF8::LATIN_SMALL_LETTER_A_WITH_ACUTE,
651c6adce8SGreg Roach        "\xA1" => UTF8::LATIN_SMALL_LETTER_I_WITH_ACUTE,
661c6adce8SGreg Roach        "\xA2" => UTF8::LATIN_SMALL_LETTER_O_WITH_ACUTE,
671c6adce8SGreg Roach        "\xA3" => UTF8::LATIN_SMALL_LETTER_U_WITH_ACUTE,
681c6adce8SGreg Roach        "\xA4" => UTF8::LATIN_SMALL_LETTER_N_WITH_TILDE,
691c6adce8SGreg Roach        "\xA5" => UTF8::LATIN_CAPITAL_LETTER_N_WITH_TILDE,
701c6adce8SGreg Roach        "\xA6" => UTF8::FEMININE_ORDINAL_INDICATOR,
711c6adce8SGreg Roach        "\xA7" => UTF8::MASCULINE_ORDINAL_INDICATOR,
721c6adce8SGreg Roach        "\xA8" => UTF8::INVERTED_QUESTION_MARK,
731c6adce8SGreg Roach        "\xA9" => UTF8::REGISTERED_SIGN,
741c6adce8SGreg Roach        "\xAA" => UTF8::NOT_SIGN,
751c6adce8SGreg Roach        "\xAB" => UTF8::VULGAR_FRACTION_ONE_HALF,
761c6adce8SGreg Roach        "\xAC" => UTF8::VULGAR_FRACTION_ONE_QUARTER,
771c6adce8SGreg Roach        "\xAD" => UTF8::INVERTED_EXCLAMATION_MARK,
781c6adce8SGreg Roach        "\xAE" => UTF8::LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK,
791c6adce8SGreg Roach        "\xAF" => UTF8::RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK,
801c6adce8SGreg Roach        "\xB0" => UTF8::LIGHT_SHADE,
811c6adce8SGreg Roach        "\xB1" => UTF8::MEDIUM_SHADE,
821c6adce8SGreg Roach        "\xB2" => UTF8::DARK_SHADE,
831c6adce8SGreg Roach        "\xB3" => UTF8::BOX_DRAWINGS_LIGHT_VERTICAL,
841c6adce8SGreg Roach        "\xB4" => UTF8::BOX_DRAWINGS_LIGHT_VERTICAL_AND_LEFT,
851c6adce8SGreg Roach        "\xB5" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_ACUTE,
861c6adce8SGreg Roach        "\xB6" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_CIRCUMFLEX,
871c6adce8SGreg Roach        "\xB7" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_GRAVE,
881c6adce8SGreg Roach        "\xB8" => UTF8::COPYRIGHT_SIGN,
891c6adce8SGreg Roach        "\xB9" => UTF8::BOX_DRAWINGS_DOUBLE_VERTICAL_AND_LEFT,
901c6adce8SGreg Roach        "\xBA" => UTF8::BOX_DRAWINGS_DOUBLE_VERTICAL,
911c6adce8SGreg Roach        "\xBB" => UTF8::BOX_DRAWINGS_DOUBLE_DOWN_AND_LEFT,
921c6adce8SGreg Roach        "\xBC" => UTF8::BOX_DRAWINGS_DOUBLE_UP_AND_LEFT,
931c6adce8SGreg Roach        "\xBD" => UTF8::CENT_SIGN,
941c6adce8SGreg Roach        "\xBE" => UTF8::YEN_SIGN,
951c6adce8SGreg Roach        "\xBF" => UTF8::BOX_DRAWINGS_LIGHT_DOWN_AND_LEFT,
961c6adce8SGreg Roach        "\xC0" => UTF8::BOX_DRAWINGS_LIGHT_UP_AND_RIGHT,
971c6adce8SGreg Roach        "\xC1" => UTF8::BOX_DRAWINGS_LIGHT_UP_AND_HORIZONTAL,
981c6adce8SGreg Roach        "\xC2" => UTF8::BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL,
991c6adce8SGreg Roach        "\xC3" => UTF8::BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT,
1001c6adce8SGreg Roach        "\xC4" => UTF8::BOX_DRAWINGS_LIGHT_HORIZONTAL,
1011c6adce8SGreg Roach        "\xC5" => UTF8::BOX_DRAWINGS_LIGHT_VERTICAL_AND_HORIZONTAL,
1021c6adce8SGreg Roach        "\xC6" => UTF8::LATIN_SMALL_LETTER_A_WITH_TILDE,
1031c6adce8SGreg Roach        "\xC7" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_TILDE,
1041c6adce8SGreg Roach        "\xC8" => UTF8::BOX_DRAWINGS_DOUBLE_UP_AND_RIGHT,
1051c6adce8SGreg Roach        "\xC9" => UTF8::BOX_DRAWINGS_DOUBLE_DOWN_AND_RIGHT,
1061c6adce8SGreg Roach        "\xCA" => UTF8::BOX_DRAWINGS_BOX_DRAWINGS_DOUBLE_UP_AND_HORIZONTAL,
1071c6adce8SGreg Roach        "\xCB" => UTF8::BOX_DRAWINGS_DOUBLE_DOWN_AND_HORIZONTAL,
1081c6adce8SGreg Roach        "\xCC" => UTF8::BOX_DRAWINGS_DOUBLE_VERTICAL_AND_RIGHT,
1091c6adce8SGreg Roach        "\xCD" => UTF8::BOX_DRAWINGS_DOUBLE_HORIZONTAL,
1101c6adce8SGreg Roach        "\xCE" => UTF8::BOX_DRAWINGS_DOUBLE_VERTICAL_AND_HORIZONTAL,
1111c6adce8SGreg Roach        "\xCF" => UTF8::CURRENCY_SIGN,
1121c6adce8SGreg Roach        "\xD0" => UTF8::LATIN_SMALL_LETTER_ETH,
1131c6adce8SGreg Roach        "\xD1" => UTF8::LATIN_CAPITAL_LETTER_ETH,
1141c6adce8SGreg Roach        "\xD2" => UTF8::LATIN_CAPITAL_LETTER_E_WITH_CIRCUMFLEX,
1151c6adce8SGreg Roach        "\xD3" => UTF8::LATIN_CAPITAL_LETTER_E_WITH_DIAERESIS,
1161c6adce8SGreg Roach        "\xD4" => UTF8::LATIN_CAPITAL_LETTER_E_WITH_GRAVE,
1171c6adce8SGreg Roach        "\xD5" => UTF8::LATIN_SMALL_LETTER_DOTLESS_I,
1181c6adce8SGreg Roach        "\xD6" => UTF8::LATIN_CAPITAL_LETTER_I_WITH_ACUTE,
1191c6adce8SGreg Roach        "\xD7" => UTF8::LATIN_CAPITAL_LETTER_I_WITH_CIRCUMFLEX,
1201c6adce8SGreg Roach        "\xD8" => UTF8::LATIN_CAPITAL_LETTER_I_WITH_DIAERESIS,
1211c6adce8SGreg Roach        "\xD9" => UTF8::BOX_DRAWINGS_LIGHT_UP_AND_LEFT,
1221c6adce8SGreg Roach        "\xDA" => UTF8::BOX_DRAWINGS_LIGHT_DOWN_AND_RIGHT,
1231c6adce8SGreg Roach        "\xDB" => UTF8::FULL_BLOCK,
1241c6adce8SGreg Roach        "\xDC" => UTF8::LOWER_HALF_BLOCK,
1251c6adce8SGreg Roach        "\xDD" => UTF8::BROKEN_BAR,
1261c6adce8SGreg Roach        "\xDE" => UTF8::LATIN_CAPITAL_LETTER_I_WITH_GRAVE,
1271c6adce8SGreg Roach        "\xDF" => UTF8::UPPER_HALF_BLOCK,
1281c6adce8SGreg Roach        "\xE0" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_ACUTE,
1291c6adce8SGreg Roach        "\xE1" => UTF8::LATIN_SMALL_LETTER_SHARP_S,
1301c6adce8SGreg Roach        "\xE2" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_CIRCUMFLEX,
1311c6adce8SGreg Roach        "\xE3" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_GRAVE,
1321c6adce8SGreg Roach        "\xE4" => UTF8::LATIN_SMALL_LETTER_O_WITH_TILDE,
1331c6adce8SGreg Roach        "\xE5" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_TILDE,
1341c6adce8SGreg Roach        "\xE6" => UTF8::MICRO_SIGN,
1351c6adce8SGreg Roach        "\xE7" => UTF8::LATIN_SMALL_LETTER_THORN,
1361c6adce8SGreg Roach        "\xE8" => UTF8::LATIN_CAPITAL_LETTER_THORN,
1371c6adce8SGreg Roach        "\xE9" => UTF8::LATIN_CAPITAL_LETTER_U_WITH_ACUTE,
1381c6adce8SGreg Roach        "\xEA" => UTF8::LATIN_CAPITAL_LETTER_U_WITH_CIRCUMFLEX,
1391c6adce8SGreg Roach        "\xEB" => UTF8::LATIN_CAPITAL_LETTER_U_WITH_GRAVE,
1401c6adce8SGreg Roach        "\xEC" => UTF8::LATIN_SMALL_LETTER_Y_WITH_ACUTE,
1411c6adce8SGreg Roach        "\xED" => UTF8::LATIN_CAPITAL_LETTER_Y_WITH_ACUTE,
1421c6adce8SGreg Roach        "\xEE" => UTF8::MACRON,
1431c6adce8SGreg Roach        "\xEF" => UTF8::ACUTE_ACCENT,
1441c6adce8SGreg Roach        "\xF0" => UTF8::SOFT_HYPHEN,
1451c6adce8SGreg Roach        "\xF1" => UTF8::PLUS_MINUS_SIGN,
1461c6adce8SGreg Roach        "\xF2" => UTF8::DOUBLE_LOW_LINE,
1471c6adce8SGreg Roach        "\xF3" => UTF8::VULGAR_FRACTION_THREE_QUARTERS,
1481c6adce8SGreg Roach        "\xF4" => UTF8::PILCROW_SIGN,
1491c6adce8SGreg Roach        "\xF5" => UTF8::SECTION_SIGN,
1501c6adce8SGreg Roach        "\xF6" => UTF8::DIVISION_SIGN,
1511c6adce8SGreg Roach        "\xF7" => UTF8::CEDILLA,
1521c6adce8SGreg Roach        "\xF8" => UTF8::DEGREE_SIGN,
1531c6adce8SGreg Roach        "\xF9" => UTF8::DIAERESIS,
1541c6adce8SGreg Roach        "\xFA" => UTF8::MIDDLE_DOT,
1551c6adce8SGreg Roach        "\xFB" => UTF8::SUPERSCRIPT_ONE,
1561c6adce8SGreg Roach        "\xFC" => UTF8::SUPERSCRIPT_THREE,
1571c6adce8SGreg Roach        "\xFD" => UTF8::SUPERSCRIPT_TWO,
1581c6adce8SGreg Roach        "\xFE" => UTF8::BLACK_SQUARE,
1591c6adce8SGreg Roach        "\xFF" => UTF8::NO_BREAK_SPACE,
1601c6adce8SGreg Roach    ];
1611c6adce8SGreg Roach}
162