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:
https://quickview.cloudapps.cisco.com/quickview/bug/CSCsm00457
https://quickview.cloudapps.cisco.com/quickview/bug/CSCur99180
For a small number of files, you can simply use vanilla Notepad in Windows, and “Save As”, selecting a new format:
https://stackoverflow.com/questions/3710374/get-encoding-of-a-file-in-windows
However, when you face this with 50+ BAT files like I did, a useful script goes a long way
Uni2Me
Using- It’s free but discontinued.
UTFCast
Using- Proprietary software
- Allows conversion from ANSI to UTF-8 with or without BOM
Using Notepad++
Python Script Plugin
Usingfrom glob import glob
from Npp import notepad
globPath = "C:\MyFiles\*.txt"
for file in glob(globPath):
notepad.open(file)
notepad.runMenuCommand("Encoding", "Convert to UTF-8-BOM")
notepad.save()
notepad.close()
Using Macros
- Start Macro recording
- Select Encoding > Convert to UTF-8-BOM
- Select all text and copy it (it’s a bug otherwise it will replace file contents with Clipboard content)
- 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
find
and iconv
Batch conversion using # 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
ls
and iconv
Batch conversion using for i in `ls *.txt`; do
iconv -f WINDOWS-1252 -t UTF8 $i -o $i.utf8
mv $i.utf8 $i
done
Change in …; do
with in $@; do
to create a usable Bash file. (e.g. convert.sh myfile.txt myfile2.txt
)
Using Batch
nkf
Add BOM to all text files using for %a in (*.txt) do nkf32 -W8 -w8 --overwrite "%a"
Download binary for Windows • Source code
Note: Change -w8
with -w80
to remove BOM
for
and iconv
Batch conversion using for %a in (*.txt) do iconv -f CP1252 -t UTF-8 "%a" > "%a"
Trivial methods
- Using paid software Replace Pioneer
I also found UTFCast quite useful…
LikeLike