xref: /webtrees/app/Encodings/ASCII.php (revision 5bfc689774bb9a6401271c4ed15a6d50652c991b)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2022 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 ASCII and UTF-8.
24 */
25class ASCII extends AbstractEncoding
26{
27    public const NAME = 'ASCII';
28
29    protected const REPLACEMENT_CHARACTER = '?';
30
31    protected const TO_UTF8 = [
32        "\x80" => UTF8::REPLACEMENT_CHARACTER,
33        "\x81" => UTF8::REPLACEMENT_CHARACTER,
34        "\x82" => UTF8::REPLACEMENT_CHARACTER,
35        "\x83" => UTF8::REPLACEMENT_CHARACTER,
36        "\x84" => UTF8::REPLACEMENT_CHARACTER,
37        "\x85" => UTF8::REPLACEMENT_CHARACTER,
38        "\x86" => UTF8::REPLACEMENT_CHARACTER,
39        "\x87" => UTF8::REPLACEMENT_CHARACTER,
40        "\x88" => UTF8::REPLACEMENT_CHARACTER,
41        "\x89" => UTF8::REPLACEMENT_CHARACTER,
42        "\x8A" => UTF8::REPLACEMENT_CHARACTER,
43        "\x8B" => UTF8::REPLACEMENT_CHARACTER,
44        "\x8C" => UTF8::REPLACEMENT_CHARACTER,
45        "\x8D" => UTF8::REPLACEMENT_CHARACTER,
46        "\x8E" => UTF8::REPLACEMENT_CHARACTER,
47        "\x8F" => UTF8::REPLACEMENT_CHARACTER,
48        "\x90" => UTF8::REPLACEMENT_CHARACTER,
49        "\x91" => UTF8::REPLACEMENT_CHARACTER,
50        "\x92" => UTF8::REPLACEMENT_CHARACTER,
51        "\x93" => UTF8::REPLACEMENT_CHARACTER,
52        "\x94" => UTF8::REPLACEMENT_CHARACTER,
53        "\x95" => UTF8::REPLACEMENT_CHARACTER,
54        "\x96" => UTF8::REPLACEMENT_CHARACTER,
55        "\x97" => UTF8::REPLACEMENT_CHARACTER,
56        "\x98" => UTF8::REPLACEMENT_CHARACTER,
57        "\x99" => UTF8::REPLACEMENT_CHARACTER,
58        "\x9A" => UTF8::REPLACEMENT_CHARACTER,
59        "\x9B" => UTF8::REPLACEMENT_CHARACTER,
60        "\x9C" => UTF8::REPLACEMENT_CHARACTER,
61        "\x9D" => UTF8::REPLACEMENT_CHARACTER,
62        "\x9E" => UTF8::REPLACEMENT_CHARACTER,
63        "\x9F" => UTF8::REPLACEMENT_CHARACTER,
64        "\xA0" => UTF8::REPLACEMENT_CHARACTER,
65        "\xA1" => UTF8::REPLACEMENT_CHARACTER,
66        "\xA2" => UTF8::REPLACEMENT_CHARACTER,
67        "\xA3" => UTF8::REPLACEMENT_CHARACTER,
68        "\xA4" => UTF8::REPLACEMENT_CHARACTER,
69        "\xA5" => UTF8::REPLACEMENT_CHARACTER,
70        "\xA6" => UTF8::REPLACEMENT_CHARACTER,
71        "\xA7" => UTF8::REPLACEMENT_CHARACTER,
72        "\xA8" => UTF8::REPLACEMENT_CHARACTER,
73        "\xA9" => UTF8::REPLACEMENT_CHARACTER,
74        "\xAA" => UTF8::REPLACEMENT_CHARACTER,
75        "\xAB" => UTF8::REPLACEMENT_CHARACTER,
76        "\xAC" => UTF8::REPLACEMENT_CHARACTER,
77        "\xAD" => UTF8::REPLACEMENT_CHARACTER,
78        "\xAE" => UTF8::REPLACEMENT_CHARACTER,
79        "\xAF" => UTF8::REPLACEMENT_CHARACTER,
80        "\xB0" => UTF8::REPLACEMENT_CHARACTER,
81        "\xB1" => UTF8::REPLACEMENT_CHARACTER,
82        "\xB2" => UTF8::REPLACEMENT_CHARACTER,
83        "\xB3" => UTF8::REPLACEMENT_CHARACTER,
84        "\xB4" => UTF8::REPLACEMENT_CHARACTER,
85        "\xB5" => UTF8::REPLACEMENT_CHARACTER,
86        "\xB6" => UTF8::REPLACEMENT_CHARACTER,
87        "\xB7" => UTF8::REPLACEMENT_CHARACTER,
88        "\xB8" => UTF8::REPLACEMENT_CHARACTER,
89        "\xB9" => UTF8::REPLACEMENT_CHARACTER,
90        "\xBA" => UTF8::REPLACEMENT_CHARACTER,
91        "\xBB" => UTF8::REPLACEMENT_CHARACTER,
92        "\xBC" => UTF8::REPLACEMENT_CHARACTER,
93        "\xBD" => UTF8::REPLACEMENT_CHARACTER,
94        "\xBE" => UTF8::REPLACEMENT_CHARACTER,
95        "\xBF" => UTF8::REPLACEMENT_CHARACTER,
96        "\xC0" => UTF8::REPLACEMENT_CHARACTER,
97        "\xC1" => UTF8::REPLACEMENT_CHARACTER,
98        "\xC2" => UTF8::REPLACEMENT_CHARACTER,
99        "\xC3" => UTF8::REPLACEMENT_CHARACTER,
100        "\xC4" => UTF8::REPLACEMENT_CHARACTER,
101        "\xC5" => UTF8::REPLACEMENT_CHARACTER,
102        "\xC6" => UTF8::REPLACEMENT_CHARACTER,
103        "\xC7" => UTF8::REPLACEMENT_CHARACTER,
104        "\xC8" => UTF8::REPLACEMENT_CHARACTER,
105        "\xC9" => UTF8::REPLACEMENT_CHARACTER,
106        "\xCA" => UTF8::REPLACEMENT_CHARACTER,
107        "\xCB" => UTF8::REPLACEMENT_CHARACTER,
108        "\xCC" => UTF8::REPLACEMENT_CHARACTER,
109        "\xCD" => UTF8::REPLACEMENT_CHARACTER,
110        "\xCE" => UTF8::REPLACEMENT_CHARACTER,
111        "\xCF" => UTF8::REPLACEMENT_CHARACTER,
112        "\xD0" => UTF8::REPLACEMENT_CHARACTER,
113        "\xD1" => UTF8::REPLACEMENT_CHARACTER,
114        "\xD2" => UTF8::REPLACEMENT_CHARACTER,
115        "\xD3" => UTF8::REPLACEMENT_CHARACTER,
116        "\xD4" => UTF8::REPLACEMENT_CHARACTER,
117        "\xD5" => UTF8::REPLACEMENT_CHARACTER,
118        "\xD6" => UTF8::REPLACEMENT_CHARACTER,
119        "\xD7" => UTF8::REPLACEMENT_CHARACTER,
120        "\xD8" => UTF8::REPLACEMENT_CHARACTER,
121        "\xD9" => UTF8::REPLACEMENT_CHARACTER,
122        "\xDA" => UTF8::REPLACEMENT_CHARACTER,
123        "\xDB" => UTF8::REPLACEMENT_CHARACTER,
124        "\xDC" => UTF8::REPLACEMENT_CHARACTER,
125        "\xDD" => UTF8::REPLACEMENT_CHARACTER,
126        "\xDE" => UTF8::REPLACEMENT_CHARACTER,
127        "\xDF" => UTF8::REPLACEMENT_CHARACTER,
128        "\xE0" => UTF8::REPLACEMENT_CHARACTER,
129        "\xE1" => UTF8::REPLACEMENT_CHARACTER,
130        "\xE2" => UTF8::REPLACEMENT_CHARACTER,
131        "\xE3" => UTF8::REPLACEMENT_CHARACTER,
132        "\xE4" => UTF8::REPLACEMENT_CHARACTER,
133        "\xE5" => UTF8::REPLACEMENT_CHARACTER,
134        "\xE6" => UTF8::REPLACEMENT_CHARACTER,
135        "\xE7" => UTF8::REPLACEMENT_CHARACTER,
136        "\xE8" => UTF8::REPLACEMENT_CHARACTER,
137        "\xE9" => UTF8::REPLACEMENT_CHARACTER,
138        "\xEA" => UTF8::REPLACEMENT_CHARACTER,
139        "\xEB" => UTF8::REPLACEMENT_CHARACTER,
140        "\xEC" => UTF8::REPLACEMENT_CHARACTER,
141        "\xED" => UTF8::REPLACEMENT_CHARACTER,
142        "\xEE" => UTF8::REPLACEMENT_CHARACTER,
143        "\xEF" => UTF8::REPLACEMENT_CHARACTER,
144        "\xF0" => UTF8::REPLACEMENT_CHARACTER,
145        "\xF1" => UTF8::REPLACEMENT_CHARACTER,
146        "\xF2" => UTF8::REPLACEMENT_CHARACTER,
147        "\xF3" => UTF8::REPLACEMENT_CHARACTER,
148        "\xF4" => UTF8::REPLACEMENT_CHARACTER,
149        "\xF5" => UTF8::REPLACEMENT_CHARACTER,
150        "\xF6" => UTF8::REPLACEMENT_CHARACTER,
151        "\xF7" => UTF8::REPLACEMENT_CHARACTER,
152        "\xF8" => UTF8::REPLACEMENT_CHARACTER,
153        "\xF9" => UTF8::REPLACEMENT_CHARACTER,
154        "\xFA" => UTF8::REPLACEMENT_CHARACTER,
155        "\xFB" => UTF8::REPLACEMENT_CHARACTER,
156        "\xFC" => UTF8::REPLACEMENT_CHARACTER,
157        "\xFD" => UTF8::REPLACEMENT_CHARACTER,
158        "\xFE" => UTF8::REPLACEMENT_CHARACTER,
159        "\xFF" => UTF8::REPLACEMENT_CHARACTER,
160    ];
161}
162