|
| 1 | +/* |
| 2 | + * Copyright 2018 ABSA Group Limited |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package za.co.absa.cobrix.cobol.parser.encoding.codepage |
| 18 | + |
| 19 | +/** |
| 20 | + * EBCDIC code page 1144. Italy. |
| 21 | + * |
| 22 | + * It corresponds to code page 280 and only differs from it in position 9F, where the euro sign € is located instead |
| 23 | + * of the international currency symbol ¤. |
| 24 | + */ |
| 25 | +class CodePage1144 extends SingleByteCodePage(CodePage1144.ebcdicToAsciiMapping) { |
| 26 | + override def codePageShortName: String = "cp1144" |
| 27 | +} |
| 28 | + |
| 29 | +object CodePage1144 { |
| 30 | + val ebcdicToAsciiMapping: Array[Char] = { |
| 31 | + import EbcdicNonPrintable._ |
| 32 | + |
| 33 | + /* This is the EBCDIC Code Page 1144 to ASCII conversion table |
| 34 | + from https://en.wikibooks.org/wiki/Character_Encodings/Code_Tables/EBCDIC/EBCDIC_280 */ |
| 35 | + val ebcdic2ascii: Array[Char] = { |
| 36 | + // Non-printable characters map used: http://www.pacsys.com/asciitab.htm |
| 37 | + Array[Char]( |
| 38 | + c00, c01, c02, c03, spc, c09, spc, del, spc, spc, spc, c0b, c0c, ccr, c0e, c0f, // 0 - 15 |
| 39 | + c10, c11, c12, c13, spc, nel, c08, spc, c18, c19, spc, spc, c1c, c1d, c1e, c1f, // 16 - 31 |
| 40 | + spc, spc, spc, spc, spc, clf, c17, c1b, spc, spc, spc, spc, spc, c05, c06, c07, // 32 - 47 |
| 41 | + spc, spc, c16, spc, spc, spc, spc, c04, spc, spc, spc, spc, c14, c15, spc, c1a, // 48 - 63 |
| 42 | + ' ', rsp, 'â', 'ä', '{', 'á', 'ã', 'å', bsh, 'ñ', '°', '.', '<', '(', '+', '!', // 64 - 79 |
| 43 | + '&', ']', 'ê', 'ë', '}', 'í', 'î', 'ï', '~', 'ß', 'é', '$', '*', ')', ';', '^', // 80 - 95 |
| 44 | + '-', '/', 'Â', 'Ä', 'À', 'Á', 'Ã', 'Å', 'Ç', 'Ñ', 'ò', ',', '%', '_', '>', '?', // 96 - 111 |
| 45 | + 'ø', 'É', 'Ê', 'Ë', 'È', 'Í', 'Î', 'Ï', 'Ì', 'ù', ':', '£', '§', qts, '=', qtd, // 112 - 127 |
| 46 | + 'Ø', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', '«', '»', 'ð', 'ý', 'þ', '±', // 128 - 143 |
| 47 | + '[', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 'ª', 'º', 'æ', '¸', 'Æ', '€', // 144 - 159 |
| 48 | + 'µ', 'ì', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '¡', '¿', 'Ð', 'Ý', 'Þ', '®', // 160 - 175 |
| 49 | + '¢', '#', '¥', '·', '©', '@', '¶', '¼', '½', '¾', '¬', '|', '¯', '¨', '´', '×', // 176 - 191 |
| 50 | + 'à', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', shy, 'ô', 'ö', '¦', 'ó', 'õ', // 192 - 207 |
| 51 | + 'è', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', '¹', 'û', 'ü', '`', 'ú', 'ÿ', // 208 - 223 |
| 52 | + 'ç', '÷', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '²', 'Ô', 'Ö', 'Ò', 'Ó', 'Õ', // 224 - 239 |
| 53 | + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '³', 'Û', 'Ü', 'Ù', 'Ú', spc) // 240 - 255 |
| 54 | + } |
| 55 | + ebcdic2ascii |
| 56 | + } |
| 57 | +} |
0 commit comments