0

I have a file which is Non-ISO Extended ASCII type. I can't see its content just by opening it normally via cat or vim. However, I'm able to see its content in readable form with this command...

od -w128 file.txt

Does anyone know how this file was created in the first place ?

2
1

There is quite a number of codepages from the DOS era. Perhaps the most popular was CP 850, for Western European languages. Quite some Microsoft software still produces such files; also, Unicode was initially rejected in the Far East, so we still find files in particular codings, generally known as CJK. You can try enca to find how your file is coded.

But no, it is not possible to know how it was created in the first place.

VIM itself can read such files, as it can convert from a range of encodings when reading files for editing. This is done with the ++enc=encoding option to the :edit command. So, for example, if you determine that the non-ISO 8-bit extended-ASCII encoding in question really is code page 850, this can be read into VIM with:

:edit ++enc=cp850 file.txt
See :help encoding-names.

5
  • You could make this answer even better by pointing out that one can read (say) code page 850 text into VIM and how one achieves that. – JdeBP Oct 31 '18 at 18:22
  • Is there a way, I can create such a file and read it with od -w128? – yogiboy Oct 31 '18 at 18:24
  • Thanks for the tip, @JdeBP, but vim is not quite my cup of tea. In GNU Emacs I know it is trivial to change the encoding interpretation when opening or refreshing a file. @yogiboy, i could not understand your comment. I understand the file is already created; what exactly do you need? – Leandro Oct 31 '18 at 18:49
  • @lfd6 mate, I meant, say I have a file abc.txt with abc in it(normal text utf8 kind). How do I create another file with abc in it but now it is a noniso extended ascii file? And if I now want to see its content, I must do something like "od -w128 newfile.txt". – yogiboy Nov 1 '18 at 1:35
  • @yogiboy, why would you want to create a file in an obsolete encoding? There are quite some utilities to convert or create file in arbitrary encodings; GNU Emacs for instance has extensive capabilities, described in its Info manual, 22.5. An interesting utility to convert is iconv. Only be sure to not ‘nonISO extended ASCII’ is but a generic description of any non-Unicode codepage. – Leandro Nov 3 '18 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.