📄 pgpcharmap.c
字号:
48, 49, 50, 51, 52, 53, 54, 55, /* 48 - 55 */
56, 57, 58, 59, 60, 61, 62, 63, /* 56 - 63 */
64, 65, 66, 67, 68, 69, 70, 71, /* 64 - 71 */
72, 73, 74, 75, 76, 77, 78, 79, /* 72 - 79 */
80, 81, 82, 83, 84, 85, 86, 87, /* 80 - 87 */
88, 89, 90, 91, 92, 93, 94, 95, /* 88 - 95 */
96, 97, 98, 99, 100, 101, 102, 103, /* 96 - 103 */
104, 105, 106, 107, 108, 109, 110, 111, /* 104 - 111 */
112, 113, 114, 115, 116, 117, 118, 119, /* 112 - 119 */
120, 121, 122, 123, 124, 125, 126, 127, /* 120 - 127 */
/*
* The high 128 characters:
* dec oct hex ch ISO_8859-1:1987
*/
0, /* 128 200 80 PA padding character (pad) */
'?', /* 129 201 81 HO high octet preset (hop) */
'?', /* 130 202 82 BH break permitted here (bph) */
'?', /* 131 203 83 NH no break here (nbh) */
'?', /* 132 204 84 IN index (ind) */
'?', /* 133 205 85 NL next line (nel) */
'?', /* 134 206 86 SA start of selected area (ssa) */
'?', /* 135 207 87 ES end of selected area (esa) */
'?', /* 136 210 88 HS character tabulation set (hts) */
'?', /* 137 211 89 HJ character tabulation with justification (htj) */
'?', /* 138 212 8a VS line tabulation set (vts) */
'?', /* 139 213 8b PD partial line forward (pld) */
'?', /* 140 214 8c PU partial line backward (plu) */
'?', /* 141 215 8d RI reverse line feed (ri) */
'?', /* 142 216 8e S2 single-shift two (ss2) */
'?', /* 143 217 8f S3 single-shift three (ss3) */
'?', /* 144 220 90 DC device control string (dcs) */
'?', /* 145 221 91 P1 private use one (pu1) */
'?', /* 146 222 92 P2 private use two (pu2) */
'?', /* 147 223 93 TS set transmit state (sts) */
'?', /* 148 224 94 CC cancel character (cch) */
'?', /* 149 225 95 MW message waiting (mw) */
'?', /* 150 226 96 SG start of guarded area (spa) */
'?', /* 151 227 97 EG end of guarded area (epa) */
'?', /* 152 230 98 SS start of string (sos) */
'?', /* 153 231 99 GC single graphic character introducer (sgci) */
'?', /* 154 232 9a SC single character introducer (sci) */
'?', /* 155 233 9b CI control sequence introducer (csi) */
'?', /* 156 234 9c ST string terminator (st) */
'?', /* 157 235 9d OC operating system command (osc) */
'?', /* 158 236 9e PM privacy message (pm) */
'?', /* 159 237 9f AC application program command (apc) */
' ', /* 160 240 a0 NS no-break space */
'!', /* 161 241 a1 !I inverted exclamation mark */
'c', /* 162 242 a2 Ct cent sign */
'#', /* 163 243 a3 Pd pound sign */
'$', /* 164 244 a4 Cu currency sign */
'Y', /* 165 245 a5 Ye yen sign */
'|', /* 166 246 a6 BB broken bar */
'S', /* 167 247 a7 SE section sign */
'"', /* 168 250 a8 ': diaeresis */
'C', /* 169 251 a9 Co copyright sign */
'a', /* 170 252 aa -a feminine ordinal indicator */
'<', /* 171 253 ab << left-pointing double angle quotation mark */
'~', /* 172 254 ac NO not sign */
'-', /* 173 255 ad -- soft hyphen */
'R', /* 174 256 ae Rg registered sign */
'_', /* 175 257 af '- overline */
'o', /* 176 260 b0 DG degree sign */
'?', /* 177 261 b1 +- plus-minus sign */
'2', /* 178 262 b2 2S superscript two */
'3', /* 179 263 b3 3S superscript three */
'\'', /* 180 264 b4 '' acute accent */
'u', /* 181 265 b5 My micro sign */
'P', /* 182 266 b6 PI pilcrow sign */
'.', /* 183 267 b7 .M middle dot */
',', /* 184 270 b8 ', cedilla */
'1', /* 185 271 b9 1S superscript one */
'o', /* 186 272 ba -o masculine ordinal indicator */
'>', /* 187 273 bb >> right-pointing double angle quotation mark */
'?', /* 188 274 bc 14 vulgar fraction one quarter */
'?', /* 189 275 bd 12 vulgar fraction one half */
'?', /* 190 276 be 34 vulgar fraction three quarters */
'?', /* 191 277 bf ?I inverted question mark */
'A', /* 192 300 c0 A! latin capital letter a with grave */
'A', /* 193 301 c1 A' latin capital letter a with acute */
'A', /* 194 302 c2 A> latin capital letter a with circumflex */
'A', /* 195 303 c3 A? latin capital letter a with tilde */
'A', /* 196 304 c4 A: latin capital letter a with diaeresis */
'A', /* 197 305 c5 AA latin capital letter a with ring above */
'E', /* 198 306 c6 AE latin capital letter ae */
'C', /* 199 307 c7 C, latin capital letter c with cedilla */
'E', /* 200 310 c8 E! latin capital letter e with grave */
'E', /* 201 311 c9 E' latin capital letter e with acute */
'E', /* 202 312 ca E> latin capital letter e with circumflex */
'E', /* 203 313 cb E: latin capital letter e with diaeresis */
'I', /* 204 314 cc I! latin capital letter i with grave */
'I', /* 205 315 cd I' latin capital letter i with acute */
'I', /* 206 316 ce I> latin capital letter i with circumflex */
'I', /* 207 317 cf I: latin capital letter i with diaeresis */
'D', /* 208 320 d0 D- latin capital letter eth (icelandic) */
'N', /* 209 321 d1 N? latin capital letter n with tilde */
'O', /* 210 322 d2 O! latin capital letter o with grave */
'O', /* 211 323 d3 O' latin capital letter o with acute */
'O', /* 212 324 d4 O> latin capital letter o with circumflex */
'O', /* 213 325 d5 O? latin capital letter o with tilde */
'O', /* 214 326 d6 O: latin capital letter o with diaeresis */
'x', /* 215 327 d7 *X multiplication sign */
'O', /* 216 330 d8 O/ latin capital letter o with stroke */
'U', /* 217 331 d9 U! latin capital letter u with grave */
'U', /* 218 332 da U' latin capital letter u with acute */
'U', /* 219 333 db U> latin capital letter u with circumflex */
'U', /* 220 334 dc U: latin capital letter u with diaeresis */
'Y', /* 221 335 dd Y' latin capital letter y with acute */
'T', /* 222 336 de TH latin capital letter thorn (icelandic) */
's', /* 223 337 df ss latin small letter sharp s (german) */
'a', /* 224 340 e0 a! latin small letter a with grave */
'a', /* 225 341 e1 a' latin small letter a with acute */
'a', /* 226 342 e2 a> latin small letter a with circumflex */
'a', /* 227 343 e3 a? latin small letter a with tilde */
'a', /* 228 344 e4 a: latin small letter a with diaeresis */
'a', /* 229 345 e5 aa latin small letter a with ring above */
'e', /* 230 346 e6 ae latin small letter ae */
'e', /* 231 347 e7 c, latin small letter c with cedilla */
'e', /* 232 350 e8 e! latin small letter e with grave */
'e', /* 233 351 e9 e' latin small letter e with acute */
'e', /* 234 352 ea e> latin small letter e with circumflex */
'e', /* 235 353 eb e: latin small letter e with diaeresis */
'i', /* 236 354 ec i! latin small letter i with grave */
'i', /* 237 355 ed i' latin small letter i with acute */
'i', /* 238 356 ee i> latin small letter i with circumflex */
'i', /* 239 357 ef i: latin small letter i with diaeresis */
'd', /* 240 360 f0 d- latin small letter eth (icelandic) */
'n', /* 241 361 f1 n? latin small letter n with tilde */
'o', /* 242 362 f2 o! latin small letter o with grave */
'o', /* 243 363 f3 o' latin small letter o with acute */
'o', /* 244 364 f4 o> latin small letter o with circumflex */
'o', /* 245 365 f5 o? latin small letter o with tilde */
'o', /* 246 366 f6 o: latin small letter o with diaeresis */
'/', /* 247 367 f7 -: division sign */
'o', /* 248 370 f8 o/ latin small letter o with stroke */
'u', /* 249 371 f9 u! latin small letter u with grave */
'u', /* 250 372 fa u' latin small letter u with acute */
'u', /* 251 373 fb u> latin small letter u with circumflex */
'u', /* 252 374 fc u: latin small letter u with diaeresis */
't', /* 253 375 fd y' latin small letter y with acute */
't', /* 254 376 fe th latin small letter thorn (icelandic) */
'y' /* 255 377 ff y: latin small letter y with diaeresis */
};
/*
* Characters not recognized (mapped to '?'):
* - Control characters 129-159
* - Plus-minus (Mapping to either + or - could be *very* misleading!)
* - Fractions 1/4, 1/2, 3/4
*
* Differences from PGP 2.x's encoding:
* - 128 (pad) is mapped to 0 (nul), the usual pad character
* - << and >> are mapped to '<' and '>' instead of '"' and '"'
* - Pilcrow (paragraph symbol) is mapped to 'P' rather than '-'
* - AE and ae are mapped to 'E' and 'e' rather than 'A' and 'a', based
* on english conventions like encyclopaedia -> encyclopedia
*/
/* *INDENT-ON* */
/**********************************************************************/
/* Charset tables */
static struct ConfMapping {
char const *name;
unsigned char const *toLatin1, *toLocal;
} confMappings[] = {
{ "noconv", charMapIdentity, charMapIdentity },
{ "ascii", charMapIdentity, latin1_to_ascii },
{ "cp850", cp850_to_latin1, latin1_to_cp850 },
{ "ebcdic", ebcdic_to_latin1, latin1_to_ebcdic },
{ (char const *)0, 0, 0 }
};
/* Case-insensitive memory compare */
static int
xmemicmp (char const *in1, char const *in2, int len)
{
while (len--) {
if (tolower(*in1) != tolower(*in2))
return 1;
in1++;
in2++;
}
return 0;
}
PGPError
pgpCharmaps (char const *charset, int setlen,
PGPByte const **toLocalP, PGPByte const **toLatin1P)
{
int i;
if (!charset || !toLocalP || !toLatin1P)
return kPGPError_BadParams;
for (i=0; confMappings[i].name; i++) {
if ((size_t)setlen != strlen (confMappings[i].name) ||
xmemicmp (charset, confMappings[i].name, setlen) != 0)
continue;
*toLocalP = confMappings[i].toLocal;
*toLatin1P = confMappings[i].toLatin1;
return kPGPError_NoErr;
}
return kPGPError_UnknownCharMap;
}
void
pgpCharmapConvert (PGPByte const *input, size_t inlen, PGPByte *output,
PGPByte const *charmap)
{
while (inlen--)
output[inlen] = charmap[input[inlen]];
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -