Which encoding to use for CMD script?

0

The Windows Command Prompt uses an ASCII table different from ours, which I do not even know what it is.

So much so that a batch with special characters when printed on screen are strange: Opção de área de influência gets OpþÒo de ßrea de influÛncia .

To correct this, without sacrificing what will be displayed on the screen, a special character replacement table is used for others that are unreadable but represent the character on the CMD ASCII screen.

Example: writing batch Op‡Æo de  rea de influˆncia it printa on screen Opção de área de influência as it should be.

I did not find an ASCII table pattern with these match, so I have to do the comparison one by one.

To facilitate I want to do a routine in C # that after the written batch it reads it and the special characters are replaced by the corresponding ones. The problem is that the output replaces the special characters with ? . I suppose this is coding problem.

I want to know which encoding to use to read the file and to write the changes to the new one.

The switch I built:

switch (Letra)
{
    case 'á': return ' ';
    case 'à': return '…';
    case 'ã': return 'Æ';
    case 'ä': return '„';
    case 'â': return 'ƒ';
    case 'Á': return 'µ';
    case 'À': return '·';
    case 'Ã': return 'Ç';
    case 'Ä': return 'Ž';
    case 'Â': return '¶';
    case 'é': return '‚';
    case 'è': return 'Š';
    case 'ë': return '‰';
    case 'ê': return 'ˆ';
    case 'É': return '';
    case 'È': return 'Ô';
    case 'Ë': return 'Ó';
    case 'Ê': return 'Ò';
    case 'í': return '¡';
    case 'ì': return '';
    case 'ï': return '‹';
    case 'î': return 'Œ';
    case 'Í': return 'Ö';
    case 'Ì': return 'Þ';
    case 'Ï': return 'Ø';
    case 'Î': return '×';
    case 'ó': return '¢';
    case 'ò': return '•';
    case 'õ': return 'ä';
    case 'ö': return '”';
    case 'ô': return '“';
    case 'Ó': return 'à';
    case 'Ò': return 'ã';
    case 'Õ': return 'å';
    case 'Ö': return '™';
    case 'Ô': return 'â';
    case 'ú': return '£';
    case 'ù': return '—';
    case 'ü': return '';
    case 'û': return '–';
    case 'Ú': return 'é';
    case 'Ù': return 'ë';
    case 'Ü': return 'š';
    case 'Û': return 'ê';
    case 'ç': return '‡';
    case 'Ç': return '€';
    default: return Letra;
}
    
asked by anonymous 06.03.2016 / 22:17

0 answers