#11 2021-06-26 23:21

Lauraq
Member
Registered: 2016-10-02
Posts: 53

Re: Renamer with names stored in a Text file

now is perfect, many thankssssss wink

Offline

#12 2021-09-26 17:27

Lauraq
Member
Registered: 2016-10-02
Posts: 53

Re: Renamer with names stored in a Text file

Hi smile
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 sad

Offline

#13 2021-10-01 20:58

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,150

Re: Renamer with names stored in a Text file

You probably need to resave your text file with UTF-8 BOM (as Unicode text).

If it doesn't resolve your issue, please share the script that you are using and provide a sample file.

Offline

#14 2021-10-01 21:32

Lauraq
Member
Registered: 2016-10-02
Posts: 53

Re: Renamer with names stored in a Text file

thanks
the list in a txt files.
The txt, for example, contain:

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

Offline

#15 2021-10-02 15:15

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,150

Re: Renamer with names stored in a Text file

As I said previously, you probably need to resave your text file with UTF-8 BOM (as Unicode text). Have you tried that?

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).

Offline

#16 2021-10-02 17:53

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,080

Re: Renamer with names stored in a Text file

Lauraq wrote:

Hi smile
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 sad


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? smile
 


Please see HELP and MANUAL in Wiki for more info.
If ReNamer had helped you, please donate a coin to Denis or buy a Pro license for commercial use. (Lite vs Pro)

Offline

#17 2021-10-02 18:08

Lauraq
Member
Registered: 2016-10-02
Posts: 53

Re: Renamer with names stored in a Text file

thanks den4b

thanks Stefan, your solution works perfectly, it's a little slower but if nothing else can be done, that's fine too smile

Offline

#18 2021-10-02 21:08

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,150

Re: Renamer with names stored in a Text file

You might be able to use FileReadLines in combination with UTF8Decode, instead of FileReadTextLines, but I'm just guessing here, because you did not provide your script and a sample file.

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.

Offline

#19 2021-10-02 23:10

Lauraq
Member
Registered: 2016-10-02
Posts: 53

Re: Renamer with names stored in a Text file

yes sure but I don't see the option for add my files.  I have post the files here:

https://justbeamit.com/4ginx

thanks

edit, new url

https://easyupload.io/2z4wft

Last edited by Lauraq (2021-10-03 10:50)

Offline

#20 2021-10-05 21:11

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,150

Re: Renamer with names stored in a Text file

Ok, I checked your script and the text file.

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.

Offline

Board footer

Powered by FluxBB