in reply to Re^7: Counting bytes in a Unicode document
in thread Counting bytes in a Unicode document

If you don't pass the file to them, they can't return the length of the file, and it's not a bug that they don't.

  • Comment on Re^8: Counting bytes in a Unicode document

Replies are listed 'Best First'.
Re^9: Counting bytes in a Unicode document
by LanX (Saint) on Oct 09, 2024 at 18:55 UTC
    Ysth and I referenced bytes and showed code to get the byte length of a Unicode string

    You replied

    > Both of those hacks will fail on Windows

    Now you are talking about not passing a file ...???

    Either bytes::length() works on Windows or it's buggy and the documentation should be fixed.

    Updates

    In hindsight, what you probably tried to say is that the OP had a problem with successfully reading the file on Windows.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

      I think the concern ikegami had is that the string will have crlf as two bytes where the file only had one.
      --
      A math joke: r = | |csc(θ)|+|sec(θ)| |-| |csc(θ)|-|sec(θ)| |

        And encoding errors are replaced with U+FFFD, which may have a different length than the original.

      There's nothing sudden about mentioning files. You seem to have forgotten the question is about the length of a file?

      So I repeat: Your "solution" of counting the bytes used to store the decoded file isn't always going to be correct.

      In hindsight, what you probably tried to say is that the OP had a problem with successfully reading the file on Windows.

      No. I clearly said it's your hack that will fail.