1<?php 2 3/** 4 * webtrees: online genealogy 5 * Copyright (C) 2021 webtrees development team 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18declare(strict_types=1); 19 20namespace Fisharebest\Webtrees\Encodings; 21 22/** 23 * Convert between UTF-8 and MacOS Roman encoding. 24 */ 25class MacRoman extends AbstractEncoding 26{ 27 public const NAME = 'MACROMAN'; 28 29 protected const TO_UTF8 = [ 30 "\x80" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_DIAERESIS, 31 "\x81" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE, 32 "\x82" => UTF8::LATIN_CAPITAL_LETTER_C_WITH_CEDILLA, 33 "\x83" => UTF8::LATIN_CAPITAL_LETTER_E_WITH_ACUTE, 34 "\x84" => UTF8::LATIN_CAPITAL_LETTER_N_WITH_TILDE, 35 "\x85" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_DIAERESIS, 36 "\x86" => UTF8::LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS, 37 "\x87" => UTF8::LATIN_SMALL_LETTER_A_WITH_ACUTE, 38 "\x88" => UTF8::LATIN_SMALL_LETTER_A_WITH_GRAVE, 39 "\x89" => UTF8::LATIN_SMALL_LETTER_A_WITH_CIRCUMFLEX, 40 "\x8A" => UTF8::LATIN_SMALL_LETTER_A_WITH_DIAERESIS, 41 "\x8B" => UTF8::LATIN_SMALL_LETTER_A_WITH_TILDE, 42 "\x8C" => UTF8::LATIN_SMALL_LETTER_A_WITH_RING_ABOVE, 43 "\x8D" => UTF8::LATIN_SMALL_LETTER_C_WITH_CEDILLA, 44 "\x8E" => UTF8::LATIN_SMALL_LETTER_E_WITH_ACUTE, 45 "\x8F" => UTF8::LATIN_SMALL_LETTER_E_WITH_GRAVE, 46 "\x90" => UTF8::LATIN_SMALL_LETTER_E_WITH_CIRCUMFLEX, 47 "\x91" => UTF8::LATIN_SMALL_LETTER_E_WITH_DIAERESIS, 48 "\x92" => UTF8::LATIN_SMALL_LETTER_I_WITH_ACUTE, 49 "\x93" => UTF8::LATIN_SMALL_LETTER_I_WITH_GRAVE, 50 "\x94" => UTF8::LATIN_SMALL_LETTER_I_WITH_CIRCUMFLEX, 51 "\x95" => UTF8::LATIN_SMALL_LETTER_I_WITH_DIAERESIS, 52 "\x96" => UTF8::LATIN_SMALL_LETTER_N_WITH_TILDE, 53 "\x97" => UTF8::LATIN_SMALL_LETTER_O_WITH_ACUTE, 54 "\x98" => UTF8::LATIN_SMALL_LETTER_O_WITH_GRAVE, 55 "\x99" => UTF8::LATIN_SMALL_LETTER_O_WITH_CIRCUMFLEX, 56 "\x9A" => UTF8::LATIN_SMALL_LETTER_O_WITH_DIAERESIS, 57 "\x9B" => UTF8::LATIN_SMALL_LETTER_O_WITH_TILDE, 58 "\x9C" => UTF8::LATIN_SMALL_LETTER_U_WITH_ACUTE, 59 "\x9D" => UTF8::LATIN_SMALL_LETTER_U_WITH_GRAVE, 60 "\x9E" => UTF8::LATIN_SMALL_LETTER_U_WITH_CIRCUMFLEX, 61 "\x9F" => UTF8::LATIN_SMALL_LETTER_U_WITH_DIAERESIS, 62 "\xA0" => UTF8::DAGGER, 63 "\xA1" => UTF8::DEGREE_SIGN, 64 "\xA2" => UTF8::CENT_SIGN, 65 "\xA3" => UTF8::POUND_SIGN, 66 "\xA4" => UTF8::SECTION_SIGN, 67 "\xA5" => UTF8::BULLET, 68 "\xA6" => UTF8::PILCROW_SIGN, 69 "\xA7" => UTF8::LATIN_SMALL_LETTER_SHARP_S, 70 "\xA8" => UTF8::REGISTERED_SIGN, 71 "\xA9" => UTF8::COPYRIGHT_SIGN, 72 "\xAA" => UTF8::TRADE_MARK_SIGN, 73 "\xAB" => UTF8::ACUTE_ACCENT, 74 "\xAC" => UTF8::DIAERESIS, 75 "\xAD" => UTF8::NOT_EQUAL_TO, 76 "\xAE" => UTF8::LATIN_CAPITAL_LETTER_AE, 77 "\xAF" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_STROKE, 78 "\xB0" => UTF8::INFINITY, 79 "\xB1" => UTF8::PLUS_MINUS_SIGN, 80 "\xB2" => UTF8::LESS_THAN_OR_EQUAL_TO, 81 "\xB3" => UTF8::GREATER_THAN_OR_EQUAL_TO, 82 "\xB4" => UTF8::YEN_SIGN, 83 "\xB5" => UTF8::MICRO_SIGN, 84 "\xB6" => UTF8::PARTIAL_DIFFERENTIAL, 85 "\xB7" => UTF8::N_ARY_SUMMATION, 86 "\xB8" => UTF8::N_ARY_PRODUCT, 87 "\xB9" => UTF8::GREEK_SMALL_LETTER_PI, 88 "\xBA" => UTF8::INTEGRAL, 89 "\xBB" => UTF8::FEMININE_ORDINAL_INDICATOR, 90 "\xBC" => UTF8::MASCULINE_ORDINAL_INDICATOR, 91 "\xBD" => UTF8::GREEK_CAPITAL_LETTER_OMEGA, 92 "\xBE" => UTF8::LATIN_SMALL_LETTER_AE, 93 "\xBF" => UTF8::LATIN_SMALL_LETTER_O_WITH_STROKE, 94 "\xC0" => UTF8::INVERTED_QUESTION_MARK, 95 "\xC1" => UTF8::INVERTED_EXCLAMATION_MARK, 96 "\xC2" => UTF8::NOT_SIGN, 97 "\xC3" => UTF8::SQUARE_ROOT, 98 "\xC4" => UTF8::LATIN_SMALL_LETTER_F_WITH_HOOK, 99 "\xC5" => UTF8::ALMOST_EQUAL_TO, 100 "\xC6" => UTF8::INCREMENT, 101 "\xC7" => UTF8::LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK, 102 "\xC8" => UTF8::RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK, 103 "\xC9" => UTF8::HORIZONTAL_ELLIPSIS, 104 "\xCA" => UTF8::NO_BREAK_SPACE, 105 "\xCB" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_GRAVE, 106 "\xCC" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_TILDE, 107 "\xCD" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_TILDE, 108 "\xCE" => UTF8::LATIN_CAPITAL_LIGATURE_OE, 109 "\xCF" => UTF8::LATIN_SMALL_LIGATURE_OE, 110 "\xD0" => UTF8::EN_DASH, 111 "\xD1" => UTF8::EM_DASH, 112 "\xD2" => UTF8::LEFT_DOUBLE_QUOTATION_MARK, 113 "\xD3" => UTF8::RIGHT_DOUBLE_QUOTATION_MARK, 114 "\xD4" => UTF8::LEFT_SINGLE_QUOTATION_MARK, 115 "\xD5" => UTF8::RIGHT_SINGLE_QUOTATION_MARK, 116 "\xD6" => UTF8::DIVISION_SIGN, 117 "\xD7" => UTF8::LOZENGE, 118 "\xD8" => UTF8::LATIN_SMALL_LETTER_Y_WITH_DIAERESIS, 119 "\xD9" => UTF8::LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS, 120 "\xDA" => UTF8::FRACTION_SLASH, 121 "\xDB" => UTF8::EURO_SIGN, 122 "\xDC" => UTF8::SINGLE_LEFT_POINTING_ANGLE_QUOTATION_MARK, 123 "\xDD" => UTF8::SINGLE_RIGHT_POINTING_ANGLE_QUOTATION_MARK, 124 "\xDE" => UTF8::LATIN_SMALL_LIGATURE_FI, 125 "\xDF" => UTF8::LATIN_SMALL_LIGATURE_FL, 126 "\xE0" => UTF8::DOUBLE_DAGGER, 127 "\xE1" => UTF8::MIDDLE_DOT, 128 "\xE2" => UTF8::SINGLE_LOW_9_QUOTATION_MARK, 129 "\xE3" => UTF8::DOUBLE_LOW_9_QUOTATION_MARK, 130 "\xE4" => UTF8::PER_MILLE_SIGN, 131 "\xE5" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_CIRCUMFLEX, 132 "\xE6" => UTF8::LATIN_CAPITAL_LETTER_E_WITH_CIRCUMFLEX, 133 "\xE7" => UTF8::LATIN_CAPITAL_LETTER_A_WITH_ACUTE, 134 "\xE8" => UTF8::LATIN_CAPITAL_LETTER_E_WITH_DIAERESIS, 135 "\xE9" => UTF8::LATIN_CAPITAL_LETTER_E_WITH_GRAVE, 136 "\xEA" => UTF8::LATIN_CAPITAL_LETTER_I_WITH_ACUTE, 137 "\xEB" => UTF8::LATIN_CAPITAL_LETTER_I_WITH_CIRCUMFLEX, 138 "\xEC" => UTF8::LATIN_CAPITAL_LETTER_I_WITH_DIAERESIS, 139 "\xED" => UTF8::LATIN_CAPITAL_LETTER_I_WITH_GRAVE, 140 "\xEE" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_ACUTE, 141 "\xEF" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_CIRCUMFLEX, 142 "\xF1" => UTF8::LATIN_CAPITAL_LETTER_O_WITH_GRAVE, 143 "\xF2" => UTF8::LATIN_CAPITAL_LETTER_U_WITH_ACUTE, 144 "\xF3" => UTF8::LATIN_CAPITAL_LETTER_U_WITH_CIRCUMFLEX, 145 "\xF4" => UTF8::LATIN_CAPITAL_LETTER_U_WITH_GRAVE, 146 "\xF5" => UTF8::LATIN_SMALL_LETTER_DOTLESS_I, 147 "\xF6" => UTF8::MODIFIER_LETTER_CIRCUMFLEX_ACCENT, 148 "\xF7" => UTF8::SMALL_TILDE, 149 "\xF8" => UTF8::MACRON, 150 "\xF9" => UTF8::BREVE, 151 "\xFA" => UTF8::DOT_ABOVE, 152 "\xFB" => UTF8::RING_ABOVE, 153 "\xFC" => UTF8::CEDILLA, 154 "\xFD" => UTF8::DOUBLE_ACUTE_ACCENT, 155 "\xFE" => UTF8::OGONEK, 156 "\xFF" => UTF8::CARON, 157 ]; 158} 159