Skip to content

Instantly share code, notes, and snippets.

@rewbs rewbs/gist:434349
Created Jun 11, 2010

What would you like to do?
import java.nio.charset.*
import java.nio.*
class ebcdic2 {
static main(args) {
Charset.metaClass.isEBCDIC = {
// This byte value of 'a' is the same in all EBCDIC flavours.
// We use can this to positively identify EBCDIC Charsets.
final ByteBuffer FIXED_EBCDIC_CODEPOINT = ByteBuffer.wrap("a".getBytes("IBM-1047"))
try {
return delegate.newDecoder()
} catch (Exception e) {
return false
println Charset
.findAll { name, charset -> charset.isEBCDIC() }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.