[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Reading a file with unknown encoding



On Fri, Sep 07, 2018 at 11:45:20PM +0200, Francesco Poli wrote:
> On Thu, 6 Sep 2018 09:36:32 +0900 akira yamada wrote:
> 
> > How about adding "-Ebinary" to the shebang line.
> [...]
> 
> Thanks for the suggestion.
> 
> Unfortunately, if I read the file in binary mode, I get what Ruby
> considers strings of binary data, which cannot be transcoded to any
> other encoding, if I understand correctly.
> This is not what I need.

Yes, but if you read in binary you can then detect what is the actual
encoding, and then convert to that.

Attachment: signature.asc
Description: PGP signature


Reply to: