Re: sed error message reports byte position instead of char position when program contains UTF-8

John Cowan <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
Eli Zaretskii scripsit:

> Yes, mostly.  But how do you know what is the encoding of the input
> files?

If you don't know that, you don't know how to interpret regular
expressions against the text of the file, because you don't know what
characters it contains.  Even in seemingly trivial cases, like "sed
s/abc/def/", you have no idea what to do if you don't know whether the
file is ASCII or EBCDIC.  For that matter, even "sed 2p" will not work
correctly if you don't know the encoding of the newline character.

So either you do just use the locale, or sed needs an option to specify
the file encoding (in which case it should also provide the command
line encoding).

-- 
Well, I have news for our current leaders       John Cowan
and the leaders of tomorrow: the Bill of        [email protected]
Rights is not a frivolous luxury, in force      http://www.ccil.org/~cowan
only during times of peace and prosperity.
We don't just push it to the side when the going gets tough.  --Molly Ivins
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.