Re: View Latin1 encoded file in a terminal with LANG set to de_DE.UTF-8

Joachim Breit <[email protected]> Tue, 24 Sep 2024 10:10:29 +0200
Newsgroups gmane.editors.nano.general
Message-ID <[email protected]>
Hi Benno,

I tried both of your advices. Fantastic! Both methods work. Thank you so 
much.

Regards
Jo

> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Fri, 20 Sep 2024 14:20:24 +0200
> From: Joachim Breit <[email protected]>
> To: [email protected]
> Subject: View Latin1 encoded file in a terminal with LANG set to
> 	de_DE.UTF-8
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=UTF-8; format=flowed
> 
> Hi,
> 
> I have a file encoded in Latin-1 (cp1252). When I open this file with
> Nano (from a terminal window in KDE) lots of characters are not
> displayed correctly), presumably because my system is set to UTF-8
> (environment variable LANG=de_DE.UTF-8). The Nano menus are displayed fine.
> 
> My first idea was to do a 'export LANG=de_DE@euro' before starting Nano.
> But then both the nano menus and the file are showing placeholder
> characters for German Umlaute an Spanish accents.
> 
> As you may guess from the problem description I am not an expert. Am I
> missing something? An encoding setting? Or is it a 'must' to have every
> file in UTF-8? Please help.
> 
> Jo
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Fri, 20 Sep 2024 17:42:15 +0200
> From: Benno Schulenberg <[email protected]>
> To: [email protected]
> Subject: Re: View Latin1 encoded file in a terminal with LANG set to
> 	de_DE.UTF-8
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
> 
> 
> Op 20-09-2024 om 14:20 schreef Joachim Breit:
>> I have a file encoded in Latin-1 (cp1252). When I open this file with Nano
>> (from a terminal window in KDE) lots of characters are not displayed
>> correctly), presumably because my system is set to UTF-8 (environment
>> variable LANG=de_DE.UTF-8). The Nano menus are displayed fine.
>>
>> My first idea was to do a 'export LANG=de_DE@euro' before starting Nano. But
>> then both the nano menus and the file are showing placeholder characters for
>> German Umlaute an Spanish accents.
> When wanting to edit a file in a different encoding, the easiest
> solution is to convert the file to UTF-8 first.  In your case:
> 
>     iconv -f cp1252 -t utf8  <yourfile  >editablefile
> 
> After editing, you can convert the file back, if needed.
> 
> 
> If conversion is not an option, then you must set not only the
> shell environment to the relevant locale, but you must also tell
> the terminal what encoding to use.  For Konsole, that should be
> somewhere in the Settings, probably the Advanced tab, Encoding,
> West-European, and then ISO-8859-1.  After that close and restart
> the terminal.  Then `export LANG=de_DE.iso88591`, and accented
> characters should be shown properly.  (Don't forget to switch
> the encoding of the terminal back afterwards.)
> 
> 
> Benno
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: OpenPGP_signature.asc
> Type: application/pgp-signature
> Size: 840 bytes
> Desc: OpenPGP digital signature
> URL: <https://lists.gnu.org/archive/html/help-nano/attachments/20240920/d131a40e/attachment.sig>
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> Help-nano mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/help-nano
> 
> 
> ------------------------------
> 
> End of Help-nano Digest, Vol 190, Issue 1
> *****************************************