Your text file uses UTF8 encoding but without identifying itself as UTF8, i.e. it is missing the BOM marker. All you have to do is resave your file with UTF8 BOM encoding, so that ReNamer and other software can determine that the content is UTF8 encoded.
Also, I have updated the script so it is now cable of loading both types of files. Set AutoDetectEncoding = False if you wish to load a UTF8 encoded file without BOM (as in your sample text file), or set AutoDetectEncoding = True to automatically determine the encoding according the file's BOM marker. Don't forget to adjust the NewNamesFile constant to suit your needs.
const
NewNamesFile = 'C:\Users\User\Downloads\Files.txt';
AutoDetectEncoding = False;
var
I: Integer;
AnsiLines: TAnsiStringArray;
UnicodeLines: TWideStringArray;
Initialized: Boolean;
begin
if not Initialized then
begin
Initialized := True;
if AutoDetectEncoding then
UnicodeLines := FileReadTextLines(NewNamesFile)
else
begin
AnsiLines := FileReadLines(NewNamesFile);
SetLength(UnicodeLines, Length(AnsiLines));
for I := 0 to Length(AnsiLines)-1 do
UnicodeLines[I] := UTF8Decode(AnsiLines[I]);
end;
I := 0;
end;
if I < Length(UnicodeLines) then
begin
FileName := UnicodeLines[I] + WideExtractFileExt(FileName);
I := I + 1;
end;
end.
thanks
edit, new url
]]>P.S. The example content that you provided is the not same as an example file, because the content alone looses the original file encoding information.
]]>thanks Stefan, your solution works perfectly, it's a little slower but if nothing else can be done, that's fine too
]]>Hi
Sorry if I reopen this old thread but there is a problem with accented letters,
if in the txt there are letters such as èòàùì the files are renamed with strange symbols
Don't use WindowsTM Notepad.exe to modify your text.
but an editor like Notepad2 from "flo's freeware".
- create a new file
- paste in your file names
- use menu "File > Encoding > UTF-8 with Signature"
- save and use
"UTF-8 with Signature" seems to be the same as "UTF-8 with BOM" and also adds the hidden BOM signature signs: 
You can also try to save as Unicode which also adds the BOM.
More infos about BOM at https://en.wikipedia.org/wiki/Byte_order_mark
HTH?
If it doesn't resolve your issue, please post your script and provide a sample file (you can send it by email, see the About dialog).
]]>01 - Il dovere è potere
02 - La notte della vittoria
03 - Bellezze al bagno
04 - George, Jerry è compagni
05 - Il campione
06 - Cuccioli sì nasce
07 - Lascia o raddoppia
and this is the preview
preview
If it doesn't resolve your issue, please share the script that you are using and provide a sample file.
]]>Try changing
end;
I := I + 1;
FileName := UnicodeLines[I];
end.
to
end;
FileName := UnicodeLines[I];
I := I + 1;
end.
]]>
Hi
Thanks, the script seems to work but there are 2 problems. The first is that when I add the files, a window pops up that says:
Preview process is terminated due to a critical error Line 14 out of range.
Be sure to have (at least) as many lines with text in your TXT file as you want to rename files.
The second problem is that the program I use to generate the list doesn't write the extensions in the txt. So if possible your script should not modify the existing extension.
Change
FileName := UnicodeLines[I];
to
FileName := UnicodeLines[I] + WideExtractFileExt(FileName);
]]>
The second problem is that the program I use to generate the list doesn't write the extensions in the txt. So if possible your script should not modify the existing extension.
Thank you
]]>