Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 12-10-2003, 12:48 AM   #1
Registered: May 2003
Location: Melbourne, Australia
Distribution: Cygwin, Windows XP
Posts: 69

Rep: Reputation: 15
UTF file in bash?

Hi All!

I have been writing some bash scripts in JEdit 4.2Pre6. I have line endings set Unix \n and UTF8 encoding.

Thing is, bash is choking on them when there is nothing wrong with the syntax.. Mostly I see this happening when I am using the line continuation character.

I know the syntax is ok because I can run the same code from a script when I save it using Kate for example.)

Is this a setting issue? Does bash not know how to read UTF8? I am using bash 2.05b-20

Thanks for any advice!
Old 12-11-2003, 10:05 AM   #2
jim mcnamara
Registered: May 2002
Posts: 964

Rep: Reputation: 36
for some things bash will be unhappy with UTF-8 standard encoding.

UTF-8 is pretty much like ASCII up to char #127 - it's one byte.
The original vertsions of bash like old-fashioned ASCII, I don't know about newer versions.

However carriage control under unix means ASCII 10 "^J" is newline -- \n.
Under UTF-8, based on unicode, you can have two characters for newline
ASCII 10 "^J" and ascii 13 "^M".

Use od on your bash scripts to look for these spuriouscarriage control chars. They will also show up in vi.

UltraEdit and some other Windows PC editors will convert lower UTF-8 to so-called unix as well.

Short answer - learn to use vi or emacs for shell scripts.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I know how a file is encoded? UTF-8, UTF-16, etc.. ?? brynjarh Linux - General 1 12-03-2004 12:11 PM
[Enter] in text documents diffrent on Windows and Linux? UTF-8/UTF-16 problem or? brynjarh Linux - General 1 11-24-2004 06:20 AM
Bash, "." and UTF-8 Provola Programming 0 10-07-2004 06:42 AM
X11 / UTF-8 locale seems missing 'fr_FR.UTF-8' chrsitophermann Debian 11 07-17-2004 03:04 PM
I need perlscript to convert text file in UTF-16 cccc Programming 3 07-04-2004 05:08 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:29 AM.

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