You could run for converting several case sensitive replaces searching (in worst case 128 times) a single ANSI character with a byte value greater than 127 to appropriate UTF-8 byte sequence. But for existing UTF-8 files that would damage the character encodings.
So it would be better to this with a macro as posted at Convert multiple files to UTF-8
But nowadays with UE v17.30 or UES v11.20 or any later version
it is even better to use a script for this task.Edited on 2013-12-05:
After most script code was already available public for this task and some script newbies needed additional help on putting my script code snippets together to a working script for this task, I have decided to write a complete, full featured script for conversion of text files to UTF-8 and publish it.
On Macros and Scripts
download page there is Convert files to UTF-8
with a link to the script file ConvertFilesToUtf8.js
This script file can be downloaded, opened in UltraEdit or UEStudio and executed by command Scripting - Run Active Script
Users of a non English version of UltraEdit/UEStudio must first edit 2 strings in the script as explained in the comments of the script.
The script user is asked if the script should be executed on files in a directory or a list of files like all open files or all project files.
If the choice is taken for running the script on all files of a directory, the script user has to enter the path to the directory, the file type specification which can contain wildcards and allows multiple strings separated by semicolons, and if all matching files in all subdirectories of the specified directory should be processed, too.
The script creates now first a list of files to process. Note: Files with Unicode charaters in name are not supported!
Then the script processes each file in the list with writing information about the activities into the output window.
Finally the script writes into the output window how many files have been processed in total, how many files have been converted to UTF-8, how many files were not modified because already being a Unicode file (encoded in UTF-8) and how many files were skipped because of being a binary file.
The script additionally searches in all files converted to UTF-8 for a character set declaration as present usually in head section of an HTML or XHTML file and for an encoding declaration as usually present in first line of an XML file and modifies those declarations also to UTF-8 to match the used encoding. The summary in output window contains also the information how many charset and how many encoding declarations were modified, too.Special hint:
If the script should be used to run on all open files, it is better to add the script file via Scripting - Scripts
to the list of scripts and run it from the menu Scripting
or the Script List
window opened with View - Views/Lists - Script List
instead of opening the script file in UE/UES and run it with command Run Active Script
The script has no code to skip itself on conversion to UTF-8. Therefore the script would on execution convert itself to UTF-8. Usually that does not really matter as ConvertFilesToUtf8.js
If a UTF-8 BOM is added by mistake to ConvertFilesToUtf8.js