Ascii dos в ansi windows

 ASCII DOS to ANSI Windows converter …

I *suggest* you a VBScript that converts ASCII DOS characters to ANSI Windows characters.
It’s not perfect because all characters are not converted … also consider this proposal as a test (or a beginning of solution).
I’m not sure too that my investigation is correct but I think that the regional page code has no rule …
I have made a comparison between ASCII and ANSI 437 page code and put the result in a Dictionnary object.

I can tell you that it (just?) works fine for me in French language … I have for instance create the file INFODOS.TXT that can be
found here :
http://www.*-*-*.com/
This file contains an ANSI Windows text file that contains the result of several french help DOS commands (with the /? switch) and
the SCII version too.

The script AsciiToAnsi.vbs can be found here for some days (part of the archive):
http://www.*-*-*.com/
(with some comments and interrogation)
The use is easy, it’s a function that you called with:
AsciiToAnsi(DataIn)
where DataIn is in ASCII DOS fomat.

To test this script, copy also the file ASCII.TXT in the same script directory that can be found here (part of the archive):
http://www.*-*-*.com/
This file is a DOS ASCII text file (so edit with EDIT.COM to view content) that contains a little french text and the ASCII
character set table.
The script demo «converts» this file to ANSI.TXT Ansi Windows file (open it with Notepad or Wordpad).

Characters works are always «chineese puzzles» … it’s possible that I have made some mistakes … I’m not expert in this domain.

I have also found a Web link about characters with detailed explanations and ton of links (be patient, the page is greater than 150
Ko) :
http://www.*-*-*.com/

Regards,

Jean (JMST)

Hi I have a string written in ascii code whose output is » ”˜‰ƒ ‰™˜€» this is a name in Hebrew. How can I convert it to Hebrew letters?
.net c# winform

asked Aug 7, 2011 at 18:04

fan-fan's user avatar

2

There are no Hebrew letters in ASCII, so you have to mean ANSI. There is a default encoding for the system that is used for encoding ANSI, which you need to know to decode it.

It’s probably the Windows-1255 or ISO 8859-8 encoding that was used. You can use the Encoding class to decode the data. Example:

Encoding.GetEncoding("ISO 8859-8").GetString(data);

If you already have a string, the problem is that you have decoded data using the wrong encoding. You have to go further back in the process before the data was a string, so that you can get the actual encoded bytes.

If you for example are reading the string from a file, you have to either read the file as bytes instead, or set the encoding that the stream reader uses to decode the file data into characters.

answered Aug 7, 2011 at 18:12

Guffa's user avatar

GuffaGuffa

688k108 gold badges739 silver badges1006 bronze badges

Content

Overview
ASCII Control Characters (0-31 and 127)
ASCII Characters6)
ANSI Characters (128-159)
ANSI Characters (160-255)

Overview

ASCII (American Standard Code for Information Interchange) is a 7-bit character set that contains characters from 0 to 127.

The generic term ANSI (American National Standards Institute) is used for 8-bit character sets. These character sets contain the unchanged ASCII character set. In addition, they contain further characters from 128 to 255, which differ in the various ANSI character sets. There are character sets for western special characters and umlauts, and for Arabic, Greek or Cyrillic characters.

The following table shows which characters are available in which (western) character set:

Did you like my page, one of my freeware applications or online tools?

Then, please donate via PayPal in order to help keeping its content free — each amount is welcome!

Read more about support options…

ASCII Control Characters (0-31 and 127)

These characters are part of ASCII, Windows-1252 and ISO-8859-1.

The characters with the ASCII codes 0 to 31 and 127 are control characters which are not intended for display.

The caret notation (in column «C») is often used in terminals to display control characters. These can usually be entered using the control key (Ctrl). For example, the notation «^C» corresponds to the key combination Ctrl+C.

The escape sequence (in column «E») is used e.g. in programming languages or search functions to be able to enter control characters as text.

ASCII Characters (32-126)

These characters are part of ASCII, Windows-1252 and ISO-8859-1.

Characters with ASCII codes 32 to 126 are so-called printable characters intended for display or output on printers.

ANSI Characters (128-159)

These characters are part of Windows-1252. In ISO-8859-1 these characters are control characters.

ANSI Characters (160-255)

These characters are part of Windows-1252 and ISO-8859-1.

Casteele/ShadowLord


  • #1

Hi,

I’m creating a database which has a VBA module to read a number of records
in from a old DOS based file (which uses the old DOS OEM characterset), and
fill an Access 2000 table with the data. However, Windows (and Access 2000)
use the ANSI character set. The StrConv function only seems to convert from
ANSI <-> Unicode, and a few other specialized charsets (Far East). But they
do not appear to handle OEM at all.

How can I convert (using only Access 2000/VBA; I cannot rely on 3-rd party
or external utilities) this data from DOS OEM to ANSI? (So far, the only
thing I can come up with is to create a table that has the OEM char in one
column, and the ANSI char in the other, then write code which loops through
the text replacing one with the other.. But I’m hoping for a better solution!)

Thanks,
C.

Advertisements

GeoffG


  • #2

I flagged your post two days ago to see if anyone with expertise in this
area would answer. If you still need comments, I have a few — and an
interest in how you actually solve the problem.

Is your DOS OEM something like Compaq DOS Version 3.31 or DR DOS? Do you
know which character numbers represent which characters?

It’s odd that the OEM didn’t use ASCII, Extended ASCII, ANSI, Code Page 437
(aka MSDOS Latin US), or some other code page. There’s also DBCS and
Unicode.

Visual Basic always uses Unicode, whichever version of Windows it’s running
on (i.e. whichever character set is native to your version of Windows).

I’m not sure there’s a better solution than something like the one you
suggest. I’d be inclined to use VBA to read the text file into a character
array, loop through the array making character substitutions where
necessary, writing back to a text file, and using the normal import wizard.

Are you happy that the text files are good (i.e. not corrupted)? Does each
character number stored in the text file reliably represent a given
character?

Regards
Geoff

    msm.ru

    Нравится ресурс?

    Помоги проекту!

    [!] Как относитесь к модерированию на этом форуме? Выскажите свое мнение здесь

    >
    Как преобразовать Ascii в Ansi?

    • Подписаться на тему
    • Сообщить другу
    • Скачать/распечатать тему

      


    Сообщ.
    #1

    ,

      Есть строка char[],( или AnsiString) в которой текст(по-русски) в Ascii, а нужно его пребразовать в Ansi.


      trainer



      Сообщ.
      #2

      ,

        Что такое «текст в Ascii» — это понятно. А вот что такое «текст в Ansi» — это загадка.
        Надо бы уточнить.


        Konigsberg



        Сообщ.
        #3

        ,

          :huh:
          Ну текст у меня в Dosовской кодировке, а нужно,чтобы был в Windowsовской:
          в Dosе:» ўЈгбв»,в Windowsе:»август» » ўЈгбв»=>:»август»


          trainer



          Сообщ.
          #4

          ,

            OemToCharA, OemToCharBuffA


            Konigsberg



            Сообщ.
            #5

            ,

              :blink:
              Извините, но что есть OemToCharA, OemToCharBuffA? В 6-ом билдере в справке ничего нет по OemToCharA, OemToCharBuffA. Не могли бы вы пояснить какой синтаксис у OemToCharA и OemToCharBuffA и в каком хедере они определены?


              Eldorado



              Сообщ.
              #6

              ,

                Full Member

                ***

                Рейтинг (т): 6

                А ты приложение консольное пишешь?


                Konigsberg



                Сообщ.
                #7

                ,

                  :P
                  С чего ты взял, не, просто чужую базу данных старую обрабатываю, а там текст в dosовской кодировке, а ты не шаришь в OemToCharA, OemToCharBuffA?

                  Сообщение отредактировано: Konigsberg


                  Shuric



                  Сообщ.
                  #8

                  ,

                    Люди, вы что. Это же API функции.Инфо про них можно в любом справочнике по API
                    функциям или в любом поисковике.

                    К тому же действительно нет такого — кодировка ANSI.
                    А что касается кодировки DOS, то она носит название OEM.


                    Konigsberg



                    Сообщ.
                    #9

                    ,

                      :huh: Странно, у меня даже пара программ(чужих) и несколько книг,где русским по белому написано «…кодировка Ascii…» и «…кодировка Ansi…»

                      Wizard

                      Bas



                      Сообщ.
                      #10

                      ,

                        ExpandedWrap disabled

                          ANSI-код (ANSI — American National Standarts Institute, Американский

                          национальный институт стандартов) используется для представления символов

                          в операционной системе Windows. Для кодирования используется 1 байт (8 бит)

                          ASCII-код (ASCII — American Standart Code for Information, американский

                          стандартный код обмена информацией) используется для представления

                          символов в операционной системе MS-DOS. Для кодирования используется в

                          обычном варианте 7 бит (поэтому можно закодировать 127 символов), в

                          расширенном варианте — 8 бит, поэтому дополнительно можно закодировать еще

                          128 символов, эти символы используются для кодирования национальных

                          алфавитов, в т. ч. русский алфавит.

                          Эти коды отличаются тем, что русский текст записанный в MS-DOS  не

                          читается в Windows и наоборот.

                        Помогите сделать прогу на Си++


                        myaut



                        Сообщ.
                        #11

                        ,

                          Цитата

                          trainer, 20.08.04, 18:06
                          OemToCharA, OemToCharBuffA

                          Да и не забудь написать #define NO_WIN32_LEAN_AND_MEAN Перед всеми хедерами.


                          AException



                          Сообщ.
                          #12

                          ,

                            Junior

                            *

                            Рейтинг (т): 2

                            WINAPI функция OemToChar:
                            Файл: winuser.h

                            ExpandedWrap disabled

                              OemToChar(

                                              LPCTSTR src,

                                              LPTSTR dest

                                             );

                            Первый параметр: указатель на строку данных OEM (заканчивающуюся ‘\0’)
                            Второй параметр: Буфер назначения (должен быть длиной не менее исходного)
                            Первый и второй параметры могут совпадать.

                            ExpandedWrap disabled

                              CharToOem(

                                              LPCTSTR src,

                                              LPTSTR dest

                                             );

                            Всё то же самое, только наоборот.

                            0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)

                            0 пользователей:

                            • Предыдущая тема
                            • Borland C++ Builder/Turbo C++ Explorer
                            • Следующая тема

                            Рейтинг@Mail.ru

                            [ Script execution time: 0,0577 ]   [ 16 queries used ]   [ Generated: 9.10.23, 03:45 GMT ]  

                          • Artmoney для windows 10 x64 на русском бесплатно без ключа
                          • Asio или wasapi в windows 10
                          • As key repository and windows dpapi to encrypt keys at rest
                          • Asio sys синий экран windows 10
                          • Arx fatalis windows 10 скачать