Skip to content

Instantly share code, notes, and snippets.

@githubutilities
Last active April 20, 2023 09:50
Show Gist options
  • Select an option

  • Save githubutilities/0edd99b4d3b38ba5d01b to your computer and use it in GitHub Desktop.

Select an option

Save githubutilities/0edd99b4d3b38ba5d01b to your computer and use it in GitHub Desktop.
Encoding Problem with `tar` file

Encoding problem with tar file

Both 7zip and rar support international character, but since tar file does not have encoding attribute, it only support ascii character. For tar file that works on windows, it may encounter a character encoding problem in mac or linux.

Convert encoding of a text file

iconv --from-code=gb2312 --to-code=utf-8 < readme.txt > out.txt

Detect encoding of file

  • For file that has encoding metadata in it, use file command
file -I <filename>
  • Use sublime text to detect the text file
  • For windows user, try trid
  • hex dump using xxd <filename> in terminal or vim

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment