Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Apr 2019 23:59:24 +0200
From:      "Rocky Hotas" <rockyhotas@post.com>
To:        "FreeBSD Questions" <freebsd-questions@freebsd.org>
Cc:        guru@unixarea.de
Subject:   Re: vi(1) and ISO 8859-1
Message-ID:  <trinity-377d302a-8822-473a-b563-ce9cc7238ad5-1554415164891@3c-app-mailcom-lxa08>
In-Reply-To: <20190404190642.GA4609@sh4-5.1blu.de>
References:  <trinity-f25766ad-e745-4e70-98d1-52c0ba83fe56-1554398089214@3c-app-mailcom-lxa05> <20190404190642.GA4609@sh4-5.1blu.de>

next in thread | previous in thread | raw e-mail | index | archive | help

> Sent: Thursday, April 04, 2019 at 9:06 PM
> From: "Matthias Apitz" <guru@unixarea.de>
> To: freebsd-questions@freebsd.org
> Subject: Re: vi(1) and ISO 8859-1

[...]

> Are you sure that the file is completely ISO-8859-1 encoded? 

Yes:

> What does
> file(1) says about

$ file myfile
myfile: ISO-8859 text

> and what happens if you run it through iconv(1)
> translating from ISO-8859-1 to UTF-8 into /dev/null, will iconv(1) do it
> or complain?

$ iconv -f ISO-8859-1 -t UTF-8 < myfile > /dev/null

It completes successfully, exit status is 0. You can easily create such a
file and reproduce this: just open vi(1), set the encoding with
`:se fe=iso-8859-1', and just type a letter with an accent, like:

hello
ì

If you save it and reopen it with vi(1), it will use UTF-8 by default and it
won't be able to read the line with `ì', unless you again use
`:se fe=iso-8859-1'.

The correctness (and integrity) of the ISO 8859-1 encoding is also shown by
hexdump:

$ hexdump -C myfile
00000000  68 65 6c 6c 6f 0a ec 0a                           |hello...|
00000008

Where `ec' is `ì' in ISO 8859-1.

Rocky

> 
> 	matthias
> -- 
> Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
> Public GnuPG key: http://www.unixarea.de/key.pub
> 70 years of NATO - 70 years of wars (Jugoslavia, Afghanistan, Syria, ...) and 70 years
> of war preparation against Russia.  -- PEACE instead of NATO !



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?trinity-377d302a-8822-473a-b563-ce9cc7238ad5-1554415164891>