Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 9a9b41a
  • /
  • util
  • /
  • toutf8.sh
Raw File
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:8a4254b3df3d61f372b7514602bb175da3759c7a
directory badge Iframe embedding
swh:1:dir:ceaca9f76800df95f4fcd0860e3f2d4c8db159bd
toutf8.sh
#! /bin/sh
#
# Very simple script to detect and convert files that we want to re-encode to UTF8

git ls-tree -r --name-only HEAD | \
    while read F; do
	charset=`file -bi "$F" | sed -e 's|.*charset=||'`
	if [ "$charset" != "utf-8" -a "$charset" != "binary" -a "$charset" != "us-ascii" ]; then
	    iconv -f ISO-8859-1 -t UTF8 < "$F" > "$F.utf8" && \
		( cmp -s "$F" "$F.utf8" || \
			( echo "$F"
			  mv "$F" "$F.iso-8859-1"
			  mv "$F.utf8" "$F"
			)
		)
	fi
    done

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top