Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Create .nfo file in ISO-8859-1 or UTF-8

Shell Programming and Scripting


Tags
iconv, solved

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-10-2017
antoinelomb antoinelomb is offline
Registered User
 
Join Date: Jan 2017
Last Activity: 12 February 2017, 4:27 PM EST
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Create .nfo file in ISO-8859-1 or UTF-8

Hey guys,

I have a little problem,

Let's say I create this script :


Code:
#!/bin/sh
nfo_file="/home/admin/info.nfo"
echo "▒▒█ Hello █▒▒" > $nfo_file

It seems to be okay :

Code:
cat /home/admin/info.nfo
▒▒█ Hello █▒▒


Code:
file -bi /home/admin/info.nfo
text/plain; charset=utf-8

But when I open it in a Windows computer, using notepad++ i.e., this is what it output :


Code:
ΓΓΓ Hello ΓΓΓ

What can I do for it to work?

I tried this :


Code:
iconv -f utf8 -t iso88591//translit sample.nfo -o sample2.nfo
Ouput on Windows : ??? Hello ???


Code:
iconv -f utf8 -t utf8//translit sample.nfo -o sample2.nfo
Ouput on Windows : ΓΓΓ Hello ΓΓΓ

Thanks for the help.

Antoine L.
Sponsored Links
    #2  
Old Unix and Linux 01-10-2017
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 21 February 2017, 2:28 PM EST
Location: Aachen, Germany
Posts: 10,313
Thanks: 242
Thanked 3,143 Times in 2,910 Posts
There doesn't seem to be an equivalent of those UTF-8 characters in the iso8859-1 character encoding that iconv knows of. Can you switch that windows computer to UTF-8? Can you replace the chars manually?
Sponsored Links
    #3  
Old Unix and Linux 01-10-2017
antoinelomb antoinelomb is offline
Registered User
 
Join Date: Jan 2017
Last Activity: 12 February 2017, 4:27 PM EST
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
In fact, I don't need it to be iso88591, I just need it to be recognized by notepad++, it can stay in utf-8.

What do you mean by that? Replace the chars in the file? Probably, but still not showing correctly in notepad++.

Thanks!!


Envoy de mon iPhone en utilisant Tapatalk
    #4  
Old Unix and Linux 01-10-2017
Chubler_XL's Unix or Linux Image
Chubler_XL Chubler_XL is offline Forum Staff  
Moderator
 
Join Date: Oct 2010
Last Activity: 21 February 2017, 7:24 PM EST
Posts: 3,368
Thanks: 141
Thanked 1,167 Times in 1,079 Posts
Try:


Code:
iconv -f utf8 -t CP437 sample.nfo -o sample2.nfo


Last edited by Chubler_XL; 01-10-2017 at 10:48 PM..
Sponsored Links
    #5  
Old Unix and Linux 01-11-2017
antoinelomb antoinelomb is offline
Registered User
 
Join Date: Jan 2017
Last Activity: 12 February 2017, 4:27 PM EST
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
I'll try that tomorrow and come back to you


Envoy de mon iPhone en utilisant Tapatalk
Sponsored Links
    #6  
Old Unix and Linux 01-11-2017
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 17 February 2017, 3:53 PM EST
Location: Saskatchewan
Posts: 21,919
Thanks: 1,049
Thanked 4,094 Times in 3,793 Posts
It probably won't look right in the UNIX charset.
Sponsored Links
    #7  
Old Unix and Linux 01-11-2017
Chubler_XL's Unix or Linux Image
Chubler_XL Chubler_XL is offline Forum Staff  
Moderator
 
Join Date: Oct 2010
Last Activity: 21 February 2017, 7:24 PM EST
Posts: 3,368
Thanks: 141
Thanked 1,167 Times in 1,079 Posts
As the extension you used was .nfo I'm guessing you wanted a file that uses DOS (codepage 437) characters. Quite commonly used in ANSI art.

Notepad++ is quite capable of viewing UTF-8, simply select Encoding->UTF-8.

The version of Notepad++ I have (v5.9.6.2) doesn't have CP437 encoding however most of the DOS graphics characters will display OK with Encoding->Character sets->Greek->OEM 737 or Hebrew->OEM 862
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Bash to search file based off user input then create new file cmccabe Shell Programming and Scripting 5 05-01-2015 11:47 AM
Read a file and search a value in another file create third file using AWK King Kalyan Shell Programming and Scripting 11 06-19-2009 01:05 AM
Saving or writing files in unicode - IS0-8859-5 ahrong09 UNIX for Dummies Questions & Answers 0 11-12-2008 05:40 AM
Parse XML file encoded in ISO-8859-1 madhavim Shell Programming and Scripting 0 01-22-2008 09:36 AM



All times are GMT -4. The time now is 09:37 PM.