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=2Ede> > To: freebsd-questions@freebsd=2Eorg > Subject: Re: vi(1) and ISO 8859-1 [=2E=2E=2E] > Are you sure that the file is completely ISO-8859-1 encoded?=20 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=2E You can easily create such = a file and reproduce this: just open vi(1), set the encoding with `:se fe=3Diso-8859-1', and just type a letter with an accent, like: hello =C3=AC 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 `=C3=AC', unless you again use `:se fe=3Diso-8859-1'=2E The correctness (and integrity) of the ISO 8859-1 encoding is also shown b= y hexdump: $ hexdump -C myfile 00000000 68 65 6c 6c 6f 0a ec 0a |hello=2E=2E= =2E| 00000008 Where `ec' is `=C3=AC' in ISO 8859-1=2E Rocky >=20 > matthias > --=20 > Matthias Apitz, =E2=9C=89 guru@unixarea=2Ede, http://www=2Eunixarea=2Ede= / +49-176-38902045 > Public GnuPG key: http://www=2Eunixarea=2Ede/key=2Epub > 70 years of NATO - 70 years of wars (Jugoslavia, Afghanistan, Syria, =2E= =2E=2E) and 70 years > of war preparation against Russia=2E -- 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>