The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
c language + simple question regarding memory addresses and ASCII characters JamesGoh High Level Programming 7 01-30-2008 04:00 PM
Weird Ascii characters in file names yamsin789 Shell Programming and Scripting 2 10-07-2007 10:27 AM
Hex characters of ascii file budrito HP-UX 2 08-10-2005 10:26 PM
Replace characters in a string using their ascii value roops Shell Programming and Scripting 2 03-04-2005 01:51 AM
stupid question about ascii characters jalburger High Level Programming 2 09-28-2004 03:56 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-11-2005
jerardfjay jerardfjay is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 146
Multibyte characters to ASCII

Hello,

Is there any UNIX utility/command/executable that will convert mutlibyte characters to standard single byte ASCII characters in a given file?

and

Is there any UNIX utility/command/executable that will recognize multibyte characters in a given file name?

The typical multibyte character set that we might encounter are Chinese and or Japanese.

Thanks
Jerardfjay
  #2 (permalink)  
Old 11-14-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
You want the conversion to be done within a script ?

Why do you want to do that ? Those things are usually done within the application.

If your intention is to just view those ZH*/JA locale characters, then you might as well change the locale information on your machine and then view those files. Instead of the machine, the locale change can be done to your xterm itself.

Very specifically, LC_ALL and LANG variables.

It would go something like this

LC_ALL=ja_JP.euc_jp
LANG=ja_JP.euc_jp

Vino
  #3 (permalink)  
Old 11-14-2005
jerardfjay jerardfjay is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 146
Quote:
Originally Posted by vino
You want the conversion to be done within a script ?

Why do you want to do that ? Those things are usually done within the application.
Vino,

Which is precisely what I intend to do If I can do it. Unfortunately there are several apps that feed into my script and changing the back-end system is not feasible.

Even though I may not be able to change the data content represented in multi-byte character to single, If I can perform the change atleast at the file name level I should be ok.

Please advise. Thanks
Jerardfjay
  #4 (permalink)  
Old 11-14-2005
jerardfjay jerardfjay is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 146
Quote:
Originally Posted by vino
It would go something like this

LC_ALL=ja_JP.euc_jp
LANG=ja_JP.euc_jp

Vino
Vino,

I also noticed that I have two env vars set for the Language

Code:
shell>> env | grep LANG
LANG=ja_JP.euc_jp
NLS_LANG=AMERICAN_AMERICA.US7ASCII
Question: Should I unset the NLS_LANG to for my login to use the LANG variable? Please advise. Thanks.

Jerardfjay
  #5 (permalink)  
Old 11-14-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,715
POSIX locale and localedef don't support NLS_<anything> - there is an NLSPATH that is part of locale settings. With the exception of LANG, the locale variables all are LC_<something>. The NLS_<anything> variables I've seen have been in support of databases.

You will want to follow Vino's advice and use the LANG environment variable, but leave the NLS_ stuff alone. It doesn't affect locale.
  #6 (permalink)  
Old 11-14-2005
jerardfjay jerardfjay is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 146
Jim,

thanks for the clarification between the two vars. Would you happen to know if these variables are system wide settings or for individual logins? Would I require a special type of terminal emulator like exceed to see the character sets correctly or would a normal windows telnet session be okay. Please advise. Thanks.

Jerardjjay
  #7 (permalink)  
Old 11-17-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by jerardfjay
Jim,

thanks for the clarification between the two vars. Would you happen to know if these variables are system wide settings or for individual logins? Would I require a special type of terminal emulator like exceed to see the character sets correctly or would a normal windows telnet session be okay. Please advise. Thanks.

Jerardjjay
You dont need to set the locale information explicitly.

when you set these variables to values of your choice, you have the luxury of having two locales in your machine. But each locale will be specific to a terminal.

I am not sure about a telnet window displaying those characters. But on kdesktop, I could see them.

Vino
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0