Browse Source
Types cleanup; type safe refactoring; Remove unused clickhouse service; ems: GET all lines; Roles types;
mantine
Types cleanup; type safe refactoring; Remove unused clickhouse service; ems: GET all lines; Roles types;
mantine
6 changed files with 16 additions and 111 deletions
-
19client/src/interfaces/create.ts
-
1client/src/interfaces/user.ts
-
43client/src/pages/Roles.tsx
-
44client/src/utils/format.ts
-
15docker-compose.yml
-
5ems/src/api/gis/index.ts
@ -1,44 +0,0 @@ |
|||
// CP437 Character Map
|
|||
const CP437_MAP = [ |
|||
'\0', '☺', '☻', '♥', '♦', '♣', '♠', '•', '◘', '○', '◙', '♂', '♀', '♪', '♫', '☼', '►', |
|||
'◄', '↕', '‼', '¶', '§', '▬', '↨', '↑', '↓', '→', '←', '∟', '↔', '▲', '▼', ' ', '!', '"', |
|||
'#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', |
|||
'5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', |
|||
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', |
|||
'Y', 'Z', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', |
|||
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', |
|||
'}', '~', '⌂', 'Ç', 'ü', 'é', 'â', 'ä', 'à', 'å', 'ç', 'ê', 'ë', 'è', 'ï', 'î', 'ì', 'Ä', |
|||
'Å', 'É', 'æ', 'Æ', 'ô', 'ö', 'ò', 'û', 'ù', 'ÿ', 'Ö', 'Ü', '¢', '£', '¥', '₧', 'ƒ', 'á', |
|||
'í', 'ó', 'ú', 'ñ', 'Ñ', 'ª', 'º', '¿', '⌐', '¬', '½', '¼', '¡', '«', '»', '░', '▒', '▓', |
|||
'│', '┤', '╡', '╢', '╖', '╕', '╣', '║', '╗', '╝', '╜', '╛', '┐', '└', '┴', '┬', '├', '─', |
|||
'┼', '╞', '╟', '╚', '╔', '╩', '╦', '╠', '═', '╬', '╧', '╨', '╤', '╥', '╙', '╘', '╒', '╓', |
|||
'╫', '╪', '┘', '┌', '█', '▄', '▌', '▐', '▀', 'α', 'ß', 'Γ', 'π', 'Σ', 'σ', 'µ', 'τ', 'Φ', |
|||
'Θ', 'Ω', 'δ', '∞', 'φ', 'ε', '∩', '≡', '±', '≥', '≤', '⌠', '⌡', '÷', '≈', '°', '∙', '·', |
|||
'√', 'ⁿ', '²', '■', ' ' |
|||
]; |
|||
|
|||
function decodeCP437ToBytes(garbledString: string) { |
|||
const bytes = []; |
|||
for (const char of garbledString) { |
|||
const byte = CP437_MAP.indexOf(char); |
|||
if (byte === -1) { |
|||
//console.warn(`Character '${char}' not found in CP437 map`);
|
|||
bytes.push(63); // '?' as a placeholder
|
|||
} |
|||
bytes.push(byte); |
|||
} |
|||
return Uint8Array.from(bytes); |
|||
} |
|||
|
|||
function decodeWindows1251FromBytes(byteArray: any) { |
|||
const decoder = new TextDecoder('windows-1251'); |
|||
return decoder.decode(byteArray); |
|||
} |
|||
|
|||
export function decodeDoubleEncodedString(garbledString: string) { |
|||
// Step 1: Decode from CP437 to bytes
|
|||
const bytes = decodeCP437ToBytes(garbledString); |
|||
|
|||
// Step 2: Decode bytes as WINDOWS-1251
|
|||
return decodeWindows1251FromBytes(bytes); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue