Index: /trunk/Ohana/src/libfits/include/gfitsio.h
===================================================================
--- /trunk/Ohana/src/libfits/include/gfitsio.h	(revision 37038)
+++ /trunk/Ohana/src/libfits/include/gfitsio.h	(revision 37039)
@@ -27,6 +27,8 @@
 # define FT_RECORD_SIZE        2880  /* FITS block size */
 
+# define FT_BZERO_INT8 -1.0*0x80
 # define FT_BZERO_INT16 1.0*0x8000	  
 # define FT_BZERO_INT32 1.0*0x80000000
+# define FT_BZERO_INT64 1.0*0x8000000000000000
 
 /* this structure defines the buffer which contains a header
Index: /trunk/Ohana/src/libfits/table/F_get_column.c
===================================================================
--- /trunk/Ohana/src/libfits/table/F_get_column.c	(revision 37038)
+++ /trunk/Ohana/src/libfits/table/F_get_column.c	(revision 37039)
@@ -75,4 +75,9 @@
   Pout = array;
   if (!strcmp (type, "char")) {
+    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
+      *(char *)Pout = *(char *)Pin*Bscale + Bzero;
+    }
+  }
+  if (!strcmp (type, "byte")) {
     for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
       *(char *)Pout = *(char *)Pin*Bscale + Bzero;
Index: /trunk/Ohana/src/libfits/table/F_set_column.c
===================================================================
--- /trunk/Ohana/src/libfits/table/F_set_column.c	(revision 37038)
+++ /trunk/Ohana/src/libfits/table/F_set_column.c	(revision 37039)
@@ -81,5 +81,11 @@
   Pin = data;
   Pout = array;
+  // does it makes sense to scale 'char' data?
   if (!strcmp (type, "char")) {
+    for (i = 0; i < Nval*Nrow; i++, Pin+=Nbytes, Pout+=Nbytes) {
+      *(char *)Pout = (*(char *)Pin - Bzero) / Bscale;
+    }
+  }
+  if (!strcmp (type, "byte")) {
     for (i = 0; i < Nval*Nrow; i++, Pin+=Nbytes, Pout+=Nbytes) {
       *(char *)Pout = (*(char *)Pin - Bzero) / Bscale;
@@ -221,4 +227,7 @@
   Pout = array;
 
+  // # define ASSIGN_DATA(ITYPE,INAME,ISIZE,OTYPE,ONAME)
+  // if (!strcmp (intype, #ITYPE)) {
+
   /** input == char **/
   if (!strcmp (outtype, "char") && !strcmp (intype, "char")) {
@@ -228,4 +237,10 @@
     }
   }
+  if (!strcmp (outtype, "byte") && !strcmp (intype, "char")) {
+    int NbytesIn = 1;
+    for (i = 0; i < Nval*Nrow; i++, Pin+=NbytesIn, Pout+=NbytesOut) {
+      *(char *)Pout = (*(char *)Pin - Bzero) / Bscale;
+    }
+  }
   if (!strcmp (outtype, "short") && !strcmp (intype, "char")) {
     int NbytesIn = 1;
@@ -265,4 +280,63 @@
   }
   if (!strcmp (outtype, "double") && !strcmp (intype, "char")) {
+    int NbytesIn = 1;
+    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
+      *(double *)Pout = (*(char *)Pin - Bzero) / Bscale;
+# ifdef BYTE_SWAP
+      SWAP_DBLE;
+# endif
+    }
+  }
+
+  /** input == byte **/
+  if (!strcmp (outtype, "char") && !strcmp (intype, "byte")) {
+    int NbytesIn = 1;
+    for (i = 0; i < Nval*Nrow; i++, Pin+=NbytesIn, Pout+=NbytesOut) {
+      *(char *)Pout = (*(char *)Pin - Bzero) / Bscale;
+    }
+  }
+  if (!strcmp (outtype, "byte") && !strcmp (intype, "byte")) {
+    int NbytesIn = 1;
+    for (i = 0; i < Nval*Nrow; i++, Pin+=NbytesIn, Pout+=NbytesOut) {
+      *(char *)Pout = (*(char *)Pin - Bzero) / Bscale;
+    }
+  }
+  if (!strcmp (outtype, "short") && !strcmp (intype, "byte")) {
+    int NbytesIn = 1;
+    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
+      *(short *)Pout = (*(char *)Pin - Bzero) / Bscale;
+# ifdef BYTE_SWAP
+      SWAP_BYTE;
+# endif
+    }  
+  }
+  if (!strcmp (outtype, "int") && !strcmp (intype, "byte")) {
+    int NbytesIn = 1;
+    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
+      *(int *)Pout = (*(char *)Pin - Bzero) / Bscale;
+# ifdef BYTE_SWAP
+      SWAP_WORD;
+# endif
+    }
+  }
+  if (!strcmp (outtype, "int64_t") && !strcmp (intype, "byte")) {
+    int NbytesIn = 1;
+    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
+      *(int64_t *)Pout = (*(char *)Pin - Bzero) / Bscale;
+# ifdef BYTE_SWAP
+      SWAP_DBLE;
+# endif
+    }
+  }
+  if (!strcmp (outtype, "float") && !strcmp (intype, "byte")) {
+    int NbytesIn = 1;
+    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
+      *(float *)Pout = (*(char *)Pin - Bzero) / Bscale;
+# ifdef BYTE_SWAP
+      SWAP_WORD;
+# endif
+    }
+  }
+  if (!strcmp (outtype, "double") && !strcmp (intype, "byte")) {
     int NbytesIn = 1;
     for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
@@ -281,4 +355,10 @@
     }
   }
+  if (!strcmp (outtype, "byte") && !strcmp (intype, "short")) {
+    int NbytesIn = 2;
+    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
+      *(char *)Pout = (*(short *)Pin - Bzero) / Bscale;
+    }
+  }
   if (!strcmp (outtype, "short") && !strcmp (intype, "short")) {
     int NbytesIn = 2;
@@ -334,4 +414,10 @@
     }
   }
+  if (!strcmp (outtype, "byte") && !strcmp (intype, "int")) {
+    int NbytesIn = 4;
+    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
+      *(char *)Pout = (*(int *)Pin - Bzero) / Bscale;
+    }
+  }
   if (!strcmp (outtype, "short") && !strcmp (intype, "int")) {
     int NbytesIn = 4;
@@ -387,4 +473,10 @@
     }
   }
+  if (!strcmp (outtype, "byte") && !strcmp (intype, "int64_t")) {
+    int NbytesIn = 8;
+    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
+      *(char *)Pout = (*(int64_t *)Pin - Bzero) / Bscale;
+    }
+  }
   if (!strcmp (outtype, "short") && !strcmp (intype, "int64_t")) {
     int NbytesIn = 8;
@@ -440,4 +532,10 @@
     }
   }
+  if (!strcmp (outtype, "byte") && !strcmp (intype, "float")) {
+    int NbytesIn = 4;
+    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
+      *(char *)Pout = (*(float *)Pin - Bzero) / Bscale;
+    }
+  }
   if (!strcmp (outtype, "short") && !strcmp (intype, "float")) {
     int NbytesIn = 4;
@@ -488,4 +586,10 @@
   /** input == double **/
   if (!strcmp (outtype, "char") && !strcmp (intype, "double")) {
+    int NbytesIn = 8;
+    for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
+      *(char *)Pout = (*(double *)Pin - Bzero) / Bscale;
+    }
+  }
+  if (!strcmp (outtype, "byte") && !strcmp (intype, "double")) {
     int NbytesIn = 8;
     for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
Index: /trunk/Ohana/src/libfits/table/F_table_format.c
===================================================================
--- /trunk/Ohana/src/libfits/table/F_table_format.c	(revision 37038)
+++ /trunk/Ohana/src/libfits/table/F_table_format.c	(revision 37039)
@@ -19,11 +19,14 @@
   if ((Nv == 0) && (Fchar == format)) Nv = 1;
 
+  // NOTE: X, L, B all are stored in 1-byte columns (X by default has at least room for 8 bits)
+  // I report these as type 'byte' as opposed to 'char', which is interpreted as a string
+
   *Nbytes = 0;
   switch (*Fchar) {
   case  'X':
-    { *Nbytes = 1;  strcpy (type, "char");   *Nval = 1 + (int) Nv / 8; }
+    { *Nbytes = 1;  strcpy (type, "byte");   *Nval = 1 + (int) Nv / 8; }
     break;
   case  'L':
-    { *Nbytes = 1;  strcpy (type, "char");   *Nval = Nv;               }
+    { *Nbytes = 1;  strcpy (type, "byte");   *Nval = Nv;               }
     break;
   case  'A':
@@ -31,5 +34,5 @@
     break;
   case  'B':
-    { *Nbytes = 1;  strcpy (type, "char");   *Nval = Nv;               }
+    { *Nbytes = 1;  strcpy (type, "byte");   *Nval = Nv;               }
     break;
   case  'I':
@@ -268,5 +271,14 @@
     }
 
+    // Does it make sense to scale 'char' data (as opposed to 'byte')?
     if (!strcmp (type, "char"))   { 
+      for (j = 0; j < Ny; j++) {
+	for (n = 0; n < Nval; n++) {
+	  tmpChar = (char *)&ftable[0].buffer[j*Nx + n*Nbytes + off];
+	  *tmpChar = *tmpChar * tscale + tzero;
+	}
+      }
+    }
+    if (!strcmp (type, "byte"))   { 
       for (j = 0; j < Ny; j++) {
 	for (n = 0; n < Nval; n++) {
@@ -352,4 +364,5 @@
     }
 
+    // does this make sense? (see note above)
     if (!strcmp (type, "char"))   { 
       for (j = 0; j < Ny; j++) {
@@ -360,4 +373,12 @@
       }
     }
+    if (!strcmp (type, "byte"))   { 
+      for (j = 0; j < Ny; j++) {
+	for (n = 0; n < Nval; n++) {
+	  tmpChar = (char *)&ftable[0].buffer[j*Nx + n*Nbytes + off];
+	  *tmpChar = (*tmpChar - tzero) / tscale;
+	}
+      }
+    }
     if (!strcmp (type, "short"))   { 
       for (j = 0; j < Ny; j++) {
