BAT Import Fails – Unmapped Exception bad header in block 1 record 15, header magic is not ‘ustar’ or unix-style zeros

If you hit this issue when uploading a BAT file, it’s probably because your bat files are encoded in ANSI, not UTF-8.

Yes, it is a CUCM defect:


For a small number of files, you can simply use vanilla Notepad in Windows, and “Save As”, selecting a new format:


However, when you face this with 50+ BAT files like I did, a useful script goes a long way

Using Uni2Me

  • It’s free but discontinued.

Using UTFCast

  • Proprietary software
  • Allows conversion from ANSI to UTF-8 with or without BOM

Using Notepad++

Using Python Script Plugin

from glob import glob
from Npp import notepad

globPath = "C:\MyFiles\*.txt"

for file in glob(globPath):
  notepad.runMenuCommand("Encoding", "Convert to UTF-8-BOM")

Using Macros

  1. Start Macro recording
  2. Select Encoding > Convert to UTF-8-BOM
  3. Select all text and copy it (it’s a bug otherwise it will replace file contents with Clipboard content)
  4. Save file and close it

Using Bash

Add BOM to an already encoded UTF-8 file

echo -ne '\xEF\xBB\xBF' > utf8-no-bom.txt

Batch conversion using find and iconv

# Find all .txt files and convert them to UTF-8 (assuming US characters only / ANSI)
find *.txt -exec 'iconv -f CP1252 -t UTF-8  {} > {}'

# all Windows character sets
iconv -l | grep -i windows

Batch conversion using ls and iconv

for i in `ls *.txt`; do
  iconv -f WINDOWS-1252 -t UTF8 $i -o $i.utf8
  mv $i.utf8 $i

Change in …; do with in $@; do to create a usable Bash file. (e.g. myfile.txt myfile2.txt)

Using Batch

Add BOM to all text files using nkf

for %a in (*.txt) do nkf32 -W8 -w8 --overwrite "%a"

Download binary for WindowsSource code

Note: Change -w8 with -w80 to remove BOM

Batch conversion using for and iconv

for %a in (*.txt) do iconv -f CP1252 -t UTF-8 "%a" > "%a"

Trivial methods


One thought on “BAT Import Fails – Unmapped Exception bad header in block 1 record 15, header magic is not ‘ustar’ or unix-style zeros

Leave a Reply to jonathan Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.