You are not logged in.
Pages: 1
Hello everyone, I have run into a problem, and I don't know how to code, so even though I have been banging my head at it for several hours, I have still not figured it out.
Here is the file name example:
@4f60@597d@5927@5bb6.pdf
I have figured it out that these are Unicode format letters. But I have not found out how to transit these back to the original text that they stands for. I recon it involves using pascal script, but like I said, I can't figure it out.
Can someone please help? Thank you!
And to Denis, thank you for this clean and powerful software! I like it a lot!
Last edited by terrytw (2022-11-08 07:32)
Offline
The script included below will convert those Unicode hex codes into the underlying characters.
The example filename "@4f60@597d@5927@5bb6.pdf" will get converted to "你好大家.pdf".
var
Positions: TIntegerArray;
Matches: TWideStringArray;
I, CountMatches: Integer;
Character: WideString;
CharacterCode: Word;
begin
CountMatches := FindRegEx(FileName, '@[0-9a-f]{4}\b', False, Positions, Matches);
for I := CountMatches - 1 downto 0 do
begin
Character := WideCopy(FileName, Positions[I] + 1, Length(Matches[I]) - 1);
CharacterCode := HexToInt(Character);
Character := WideChr(CharacterCode);
WideDelete(FileName, Positions[I], Length(Matches[I]));
WideInsert(Character, FileName, Positions[I]);
end;
end.
This script is for the Pascal Script rule.
Offline
Wow, many thanks to you!
I did not expect it to be such a hassle, I though it would be s simple 2 liner using a function.
Sorry for the trouble...
Offline
Pages: 1