Thursday, February 22, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 1113  / 3 Years ago, sat, june 5, 2021, 9:33:43

Is there a way to tell what encoding is used for the name and content of a file? Both GUI and terminal solutions (preferred) are fine. Thanks and regards!


More From » encoding

 Answers
2

You could try



chardet <<<filename


The chardet program can try to guess the encoding of the stream on stdin, and <<< is the mean by which bash use a string as stdin, the same as



echo filename | chardet


For a whole directory content you can use



ls dir | chardet


EDIT



I forgot about the content, but is almost the same:



chardet <filename


or



cat filename | chardet


or for all the files in dir



cat dir/* | chardet

[#44688] Sunday, June 6, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
icielight

Total Points: 158
Total Questions: 92
Total Answers: 93

Location: San Marino
Member since Thu, Jun 30, 2022
2 Years ago
;