Skip to content

Instantly share code, notes, and snippets.

@mustangostang
Last active November 21, 2022 14:24
Show Gist options
  • Save mustangostang/1a6dc06a20d0dae8019c to your computer and use it in GitHub Desktop.
Save mustangostang/1a6dc06a20d0dae8019c to your computer and use it in GitHub Desktop.
Convert windows-1251 to utf-8
#!/bin/zsh
for file in ./**/*.php
do
iconv -f windows-1251 -t UTF-8 "$file" > "${file%.php}-utf8.php"
rm $file
mv ${file%.php}-utf8.php $file
done
@maxstepanyuk
Copy link

Will this work with other files, such as .cpp if I change every ".php" to ".cpp" in the script?

@mustangostang
Copy link
Author

yeah why not

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