Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to convert String to EBCIDC format

 
yashpal waghmare
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to convert String to EBCIDC format.
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 exampledepot.com for more information.
[ December 10, 2008: Message edited by: Mark Vedder ]
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cool...

off to the intermediate forum
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic