Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Java Unicode in Terminal

Java Unicode in Terminal
Thread Tools
Fresh-Faced Recruit
Join Date: Aug 2001
Location: London
Status: Offline
Reply With Quote
Nov 24, 2004, 12:31 PM
 
Does someone know how to print Unicode characters in the terminal from a java application.

This prints out a ? instead of a £.

//Prints out pound sign

public class Test
{
public static void main( String[] args )
{
System.out.println("\u00A3") ;
}
}

ive followed the Configuring Terminal to display high-bit characters in terminal help and googled. i get this on different machines running 10.3.
     
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
Nov 24, 2004, 12:49 PM
 
Terminal.app doesn't support unicode output AFAIK.

Run your app in XTerm (supplied with Apple's X11) and it works fine.
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
Nov 24, 2004, 12:59 PM
 
Ok, I lied (kinda).


Go to Terminal.app, Window Settings, Display, Character Encoding

Now, if you select UTF-8 (as common sense would dictate) it wont work.
But, if you select Western (ISO Latin 1) it works fine and indeed shows the £.
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
Fresh-Faced Recruit
Join Date: Aug 2001
Location: London
Status: Offline
Reply With Quote
Nov 24, 2004, 02:09 PM
 
brilliant, you rock.
     
   
Thread Tools
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -5. The time now is 09:22 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2