File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes Solaris and Encoding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Solaris and Encoding" Watch "Solaris and Encoding" New topic

Solaris and Encoding

Gobiraj Vadivelrajan

Joined: Dec 10, 2001
Posts: 29
I have a simple program which prints ISO-8859-1 Symbol (Octal value 247)
I get the correct out put in a HP machine but I get ? in solaris(SunOS 5.8)

Thanks for any help
[ August 15, 2003: Message edited by: Gobiraj Vadivelrajan ]
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Perhaps the solaris machine isn't using a font that is capable of displaying that character.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Or, this might include an OS-specific issue. So, I'm moving this to The Linux/UNIX Forum...
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11778

Under Linux (RedHat 9, kernel 2.4.20) and Solaris (SunOS 5.8) the output I get is a "�" (if that doesnt show up properly, it kind of looks like an "S" with the center diagonal split).
Under Linux I was running in an "aterm" (similar to xterm) and java version "1.4.0_01"
Under Solaris I was running in an xterm with java version "1.4.2"
Telneting from the Linux box to the Solaris box, still gave me the same symbol.
Telneting from a Windows 2000 machine to the Solaris box gave me what appeared to be a degree symbol with a line immediately underneath it "�"
Ahhh: got it. From the console of the Solaris box, I get a question mark being displayed. Whereas the console of the Linux box shows the "�" character.
OK, so this is just Sun catering for low level consoles - Sun have made a decision not to support displaying certain characters at the console.
This should not cause you problems - try sending the output to a file, then look at that file from your HPUX box - it should appear correctly. It is only the console display that is appearing incorrectly. Do you really need that particular character on a display that can only be read by a human at the console?
Regards, Andrew

The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17423

BTW, in my web browser, that displays as a "section" symbol (an S-like shape with an empty circle in its middle.
The problem here is that what character displays in a window (or on a monitor screen) is very dependent on what fonts are attached to it. If you tried to read text on a Cyrillic or Arabic terminal, you'd likely see nothing intelligible at all.
In the real world, ASCII is pretty much the norm, and ASCII is a 7-bit code which maps to digits, upper-and-lower-case letters and various special characters. Even there you'll see variations, as the currency symbol that's a dollar sign on a US system may display as a "Pound Sterling" on a UK terminal.
In the ancient times, the character glyphs were encoded in ROM inside the terminal and more or less fixed. These days we're usually using graphi displays and can add fonts at will. The problem then becomes a matter of attaching the right font to the right program(s). How you do that depends on the program. Xterm, for example, has some startup options. The terminal program I use with Linux has a font selection menu at the top of the window. In Microsoft Windows, there are various ways to do this, including PIF file settings. In Java, you code the the app to specify what font(s) you want to use.
Web browsers are about the worst - you can do some basic setup information for the browser app, and you can code requirements on the web page, but you're still not guaranteed that the recipient actually has those fonts. Earlier browsers had downloadable font capabilities, but they were incompatible and a real pain, so I don't know how much of this is actually done.
Unless you know what fonts will be used by people using your systems or can mandate their font environment, it's a good idea to limit to the basic 7-bit ASCII. A slightly less safe alternative for European users is ASCII+the additional Western European characters (umlaut and accent characters, etc.), which are more or less standardized thanks to IBM's extensions.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Solaris and Encoding
jQuery in Action, 3rd edition