Search code examples
encodingnotepad++iso-8859-1

How to convert the encoding of a file to ISO-8859-1 in Notepad++?


I have a file in UTF-8 and I need to convert it to iso-8859-1. I know notepad++ can convert encoding, you click on convert to ANSI for example, and you have your file modified, you can see it by the save button that became red. I understand that converting is to change bytes and that's what I want ! But I don't know how to select the encoding I want in notepad++. There is only 5 encoding to choose from : ANSI; UTF-8 without BOM; UTF-8; UCS-2 Big Endian; UCS-2 Little Endian. How do I choose another one ?


Solution

    1. Use Encoding -> Convert to ANSI
    2. Use Encoding -> Character sets -> Western European -> ISO 8859-1.

    Say you have a file enc_test.txt, created as UTF-8 with the content Ä (German Umlaut "A" with points):

    Before step 1:

    cat -A enc_test.txt 
    M-CM-^D
    
    cat  enc_test.txt 
    Ä
    
    stat enc_test.txt 
      File: 'enc_test.txt'
      Size: 2               Blocks: 8          IO Block: 4096   regular file
    Device: 811h/2065d      Inode: 2885375     Links: 1
    Access: (0664/-rw-rw-r--)  Uid: ( 1000/      lf)   Gid: ( 1000/      lf)
    Access: 2016-05-20 16:56:40.852021989 +0200
    Modify: 2016-05-20 16:56:40.376021976 +0200
    Change: 2016-05-20 16:56:40.376021976 +0200
     Birth: -
    

    After step 2 (file is saved automatically) the output (in an terminal which is set to UTF-8) is:

    cat -A enc_test.txt 
    M-D
    
    cat  enc_test.txt 
    ?
    
    stat enc_test.txt 
      File: 'enc_test.txt'
      Size: 1               Blocks: 8          IO Block: 4096   regular file
    Device: 811h/2065d      Inode: 2885375     Links: 1
    Access: (0664/-rw-rw-r--)  Uid: ( 1000/      lf)   Gid: ( 1000/      lf)
    Access: 2016-05-20 16:58:10.444024488 +0200
    Modify: 2016-05-20 16:58:10.404024487 +0200
    Change: 2016-05-20 16:58:10.404024487 +0200
     Birth: -
    

    The size field and the output of cat -A tells us that something has happened.