mercoledì 4 giugno 2014

Remove BOM header from UTF-8 file in Unix

A lot of Windows editors save your UTF-8 files with the BOM header (the hexadecimal sequence ef bb bf). You have some problem when it's necessary to use these files in Unix platform.
To remove the BOM header from the your file, you can choose one of the following ways.

# On Linux
tail --bytes=+4 your_utf-8_file

# On Unix (IBM AIX or Oracle SOLARIS)
tail +4c your_utf-8_file

Ubuntu with GNU compiler tools

The GNU project offers a lot of tools for your Ubuntu machine.
To install what you need to create a C/C++ project with Automake, use the following commands:

# Install the GNU tools
sudo apt-get install build-essential libtool automake

# Install libz library
sudo apt-get install libz-dev

Use apt-get in outdated Ubuntu release

When an Ubuntu release is outdated, all source files are moved from archive.ubuntu.com to old-releases.ubuntu.com.
In order to continue to use the apt-get command, you have to update the source list (see /etc/apt/sources.list)

# replace the source list automatically
sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

# resynchronize the package index files from their sources
sudo apt-get update 

# install the newest versions of all packages currently installed on the system from the sources
sudo apt-get dist-upgrade