my dog learned polymorphism
The moose likes Java in General and the fly likes How to convert String to EBCIDC format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to convert String to EBCIDC format" Watch "How to convert String to EBCIDC format" New topic

How to convert String to EBCIDC format

yashpal waghmare

Joined: Sep 17, 2008
Posts: 24
How to convert String to EBCIDC format.
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

I assume you meant EBCDIC

Java does not directly support EBCDIC. There are actually a large number of EBCDIC variations. Java does support a number of encodings related to EBCDIC. For example, the 'Cp1047' encoding is defined as "Latin-1 character set for EBCDIC hosts".

source = "Encoding" entry at the Java Glossary

[EBCDIC is] not directly supported. EBCDIC comes in dozens of variants, most of which do not have Java support. Check out Cp037, Cp038, Cp278, Cp280, Cp284, Cp285, Cp297, Cp424, Cp500, Cp871, Cp918, Cp1046, Cp1047, Cp1048, Cp1148.

Also, to the best of my knowledge, you cannot change the encoding of a String. Since you used "String" with an uppercase 'S' I am assuming you are referring to the String class. Java stores all strings internally via unicode or UTF-16.

You can encode a string (lowercase 's') when you write it to a stream (to a file, the console, a network connection, etc). Some of the various stream classes and reader & writer classes support taking an encoding definition.

See the encoding entry at the Java Glossary, the Supported Encodings document in the Java Developers Guide, the Converting Non-Unicode Text section of the Java Tutorial, and the Converting Between Strings (Unicode) and Other Character Set Encodings example at for more information.
[ December 10, 2008: Message edited by: Mark Vedder ]
Bert Bates

Joined: Oct 14, 2002
Posts: 8898

off to the intermediate forum

Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
I agree. Here's the link:
subject: How to convert String to EBCIDC format
jQuery in Action, 3rd edition