|P is for Practical|
Processing an encoded file backwardsby LanX (Archbishop)
|on Jan 18, 2020 at 18:47 UTC||Need Help??|
LanX has asked for the wisdom of the Perl Monks concerning the following question:
lets say I wanted a sliding window to search a file from end to start.²
Now is seek operating on byte boundaries ,but read depends on the encryption layer. °
What's the best way than to read an encoded file, like in UTF-8, backwards ?
Is read fail-proof when accidentally starting inside a wide character after a seek?
Or is it better to open :raw and to search the next character (or line) boundary manually and to decode with Encode then?
I'm aware of File::ReadBackwards , but want to understand the mechanisms better and operate on windows and not lines.
²) I've been asked what I mean with "sliding window", please see this sliding window description. There I start from the beginning, but it's often favorable to start from the end. (choroba++ for pm'ing me)