Coder Social home page Coder Social logo

Comments (6)

ap avatar ap commented on August 22, 2024

That won’t happen if you add -T UTF-8.

I’m very much unsure whether that is the correct answer or just a workaround. Should rename try to do that for you? Should it try to do that for you but only under specific circumstances?

from rename.

averms avatar averms commented on August 22, 2024

The larger issue is that --noctrl should, by default, only replace the 33 control characters defined by ASCII. This way it works with ASCII filenames and UTF-8 filenames. I'm very much a beginner at Perl so I won't try too hard to guess at what the program does, but it seems like the character class [:cntrl:] is somehow matching more than just the ASCII control characters.

Upon further reading it seems like [:cntrl:] is Unicode-aware with use feature 'unicode_strings' and rename automatically enables a feature bundle for the user's version of Perl. This breaks when the strings are not Unicode, which is the case when rename is run without any -T args.

from rename.

ap avatar ap commented on August 22, 2024

You’re right.

The larger issue is that --noctrl should, by default, only replace the 33 control characters defined by ASCII.

I take it you’re saying it should use Unicode-aware [:cntrl:] under -T?

from rename.

averms avatar averms commented on August 22, 2024

You’re right.

The larger issue is that --noctrl should, by default, only replace the 33 control characters defined by ASCII.

I take it you’re saying it should use Unicode-aware [:cntrl:] under -T?

For -T, I'm not really sure what the best path is. Currently rename does match all Unicode control characters under -T, so it would be a breaking change to restrict it to the control characters defined by ASCII.

I think the simplest solution is to no feature 'unicode_strings' if the user hasn't specified -T.

from rename.

ap avatar ap commented on August 22, 2024

I think the simplest solution is to no feature 'unicode_strings' if the user hasn't specified -T.

Just for --noctrl or in general? Doing that in general would affect all patterns, including those in user code passed with -e.

from rename.

averms avatar averms commented on August 22, 2024

I think the simplest solution is to no feature 'unicode_strings' if the user hasn't specified -T.

Just for --noctrl or in general? Doing that in general would affect all patterns, including those in user code passed with -e.

In general. As it stands enabling feature unicode_strings is incorrect when the internal encoding for a string is not utf-8. Looking at https://metacpan.org/pod/Unicode::Semantics, I imagine one could devise many examples of rename(1) outputting broken utf-8.

from rename.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.