1

I need to convert a unicode text file (19,000K) to an ANSI text file for use with Essbase.

I currently have this written to convert the file but only the first 7800 lines are copying.

This is what I have in my .bat file

cmd /a /c TYPE PVTBHFM_20160708.dat > PVTBHFM_ANSI.dat

What am I missing to fully convert this file?

Is there a way to save the file in a different location?

Mike
  • 133
  • 1
  • 1
  • 13
  • 1
    This is nitpicking, but you probably mean [Windows-1252](https://en.wikipedia.org/wiki/Windows-1252). "ANSI" isn't a character encoding. Windows mislabels Windows-1252 text as ANSI a lot. – yellowantphil Jul 08 '16 at 20:25
  • 2
    @yellowantphil - http://i.imgur.com/qs70fxu.png Perfectly reasonable for him to think it's called ANSI. – SomethingDark Jul 08 '16 at 22:18
  • 1
    @yellowantphil nope. [1252 (Latin I)](https://msdn.microsoft.com/en-us/goglobal/bb964654) is merely a **particular** Windows code page (or _character encoding_ as you say). "ANSI" is a Microsoft's alias (moniker) for _**current** system Windows code page_; for instance, my one is _[1250 (Central Europe)](https://en.wikipedia.org/wiki/Windows-1250)_. Sure, all this spoonerism comes from Microsoft's large-scaled terminology approach… – JosefZ Jul 08 '16 at 23:59
  • @JosefZ I guess I should have said Windows-125[0-8], or whatever the possibilities are. – yellowantphil Jul 09 '16 at 00:01
  • How many _lines_ in the original file when only `7800` lines are copied? And how many _bytes_ in the target file? Should be (cca `±1`) a half of `19,000K` – JosefZ Jul 09 '16 at 00:28
  • @josefZ there's 23,000 lines, the output file only has 7800 lines. Target size is usually 9,700 kb after converting to ANSI, which apparently is called a bunch of other things /Windows-1252 – Mike Jul 12 '16 at 20:37
  • So target size is approx. `1/2` of source? Then, convert seems to be successful? Maybe there is (one or more) `^Z` i.e. `Ctrl`+`Z` i.e. _Substitute_ character (codepoint `U+001A`, ASCII code `26` decimal) in your data. Check difference between `type PVTBHFM_ANSI.dat` and `findstr /N "^" PVTBHFM_ANSI.dat` from an open `cmd` window. `type` would end on 7800th line while `findstr` does not care about `^Z` character interpretation and should display _all_ lines. – JosefZ Jul 13 '16 at 07:43
  • Possible duplicate of [Batch file to covert unicode text to Ansi text](https://stackoverflow.com/questions/8781367/batch-file-to-covert-unicode-text-to-ansi-text) – Vadzim Jun 04 '17 at 13:23

0 Answers0