LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-02-2021, 08:50 AM   #1
Shinare
LQ Newbie
 
Registered: Jan 2019
Distribution: Ubuntu Unity
Posts: 4

Rep: Reputation: Disabled
Wrong charsets on new files on Ubuntu Unity 20.04


Whenever I create a new text file with nano or gedit, (At least with no extension, with .txt and with .php)
the file's charset is us-ascii while it should be utf-8. New files used to always be utf-8 until about one hour ago when I downloaded a text file with us-ascii. The only thing I did with it was copy its contents to clipboard, so it shouldn't cause any system changes, but it's the only related thing that happened.
I've also tried to manually change new files' charsets with
Code:
iconv file -f us-ascii -t utf-8 -o file
but it doesn't do anything.
Code:
$ locale
LANG=en_US.UTF-8
LANGUAGE=en
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=en_GB.UTF-8
This is the only possibly relevant command I could find, and it says UTF-8 everywhere.

Last edited by Shinare; 03-02-2021 at 09:55 AM.
 
Old 03-02-2021, 09:36 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
My CentOS system calls text files ASCII until I add a character greater than 127, like a euro symbol. Then it calls it UTF-8.
 
1 members found this post helpful.
Old 03-02-2021, 09:55 AM   #3
Shinare
LQ Newbie
 
Registered: Jan 2019
Distribution: Ubuntu Unity
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by smallpond View Post
My CentOS system calls text files ASCII until I add a character greater than 127, like a euro symbol. Then it calls it UTF-8.
Looks like that might be what's happening to me too, so I guess there isn't any real issue then. Thanks.
 
Old 03-02-2021, 04:14 PM   #4
BenCollver
Rogue Class
 
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 375
Blog Entries: 2

Rep: Reputation: 172Reputation: 172
Does it help to add the BOM at the beginning of the file?

Code:
$ printf 'hello world\n' >ascii.txt
$ printf '\xef\xbb\xbfhello world\n' >utf8.txt
$ file ascii.txt 
ascii.txt: ASCII text
$ file utf8.txt 
utf8.txt: UTF-8 Unicode (with BOM) text
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble with rsync and charsets OldPlanet Linux - General 0 05-21-2006 10:26 AM
charsets not recognized Murdock1979 Linux - Software 1 01-24-2006 10:49 PM
charsets nadine.mauch Programming 7 05-17-2005 05:00 AM
Does Linux standard terminal support other charsets other than English? George2 Linux - Software 8 12-25-2003 06:27 AM
Mutt and charsets thereof Linux - Software 0 12-21-2003 06:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration