blob: b808c9bde6e4c0ef91b7ac8afcfb0fc4fe3cc7ae (
plain) (
tree)
|
|
/*
Copyright 2022-2023 Gabriel Jensen.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
*/
#include <zap/mem.h>
void zap_win1252dec(zap_chr02 * const _dest,zap_chr8 const * const _src) {
zap_chr02 * dest;
zap_chr8 const * src;
for (dest = _dest,src = _src;;++src,++dest) {
zap_chr8 const chr = *src;
if (chr == 0x0u) {
break;
}
switch (chr) {
default:
*dest = *src;
break;
case 0x81: /* Bad characters. */
case 0x8D:
case 0x8F:
case 0x90:
case 0x9D:
*dest = 0xFFFDu; /* REPLACEMENT CHARACTER */
break;
case 0x80:
*dest = 0x20ACu;
break;
case 0x82:
*dest = 0x201Au;
break;
case 0x83:
*dest = 0x192u;
break;
case 0x84:
*dest = 0x201Eu;
break;
case 0x85:
*dest = 0x2026u;
break;
case 0x86:
*dest = 0x2020u;
break;
case 0x87:
*dest = 0x2021u;
break;
case 0x88:
*dest = 0x2C6u;
break;
case 0x89:
*dest = 0x2030u;
break;
case 0x8A:
*dest = 0x160u;
break;
case 0x8B:
*dest = 0x2039u;
break;
case 0x8C:
*dest = 0x152u;
break;
case 0x8E:
*dest = 0x17Du;
break;
case 0x91:
*dest = 0x2018u;
break;
case 0x92:
*dest = 0x2019u;
break;
case 0x93:
*dest = 0x201Cu;
break;
case 0x94:
*dest = 0x201Du;
break;
case 0x95:
*dest = 0x2022u;
break;
case 0x96:
*dest = 0x2013u;
break;
case 0x97:
*dest = 0x2014u;
break;
case 0x98:
*dest = 0x2DCu;
break;
case 0x99:
*dest = 0x2122u;
break;
case 0x9A:
*dest = 0x161u;
break;
case 0x9B:
*dest = 0x203Au;
break;
case 0x9C:
*dest = 0x153u;
break;
case 0x9E:
*dest = 0x17Eu;
break;
case 0x9F:
*dest = 0x178u;
break;
}
}
}
|